/* === Referrer Glitch Overlay Styles === */

:root {
  --ref-edge-impact-width: 500px;
  --ref-edge-offset: 80px;
  --ref-light-beam-width: 900px;
  --ref-light-beam-height: 400px;
  --ref-light-beam-blur: 15px;
  --ref-light-beam-center-x: 50vw;
  --ref-light-beam-center-y: 50vh;
  --ref-light-beam-target-width: var(--ref-light-beam-width, 900px);
  --ref-light-beam-target-height: var(--ref-light-beam-height, 400px);
  --ref-light-ray-width: 800px;
  --ref-light-ray-height: 60px;
  --ref-light-ray-blur: 20px;
  --chant-reactive: 0;
}

body.referrer-desktop {
  --ref-light-beam-target-width: var(--ref-light-beam-width, 900px);
  --ref-light-beam-target-height: var(--ref-light-beam-height, 400px);
}

body.referrer-mobile {
  --ref-light-beam-target-width: clamp(420px, 120vw, 640px);
  --ref-light-beam-target-height: clamp(260px, 60vh, 380px);
}

body.referrer-mobile .edge-impact {
  right: -25vw;
  top: -15vh;
  bottom: -15vh;
  width: 80vw;
}

body.referrer-mobile .darkening-overlay {
  right: -35vw;
  top: -12vh;
  bottom: -12vh;
  width: 105vw;
  border-radius: 45%;
  background: radial-gradient(
    ellipse at right center,
    rgba(0, 0, 0, 0.6),
    rgba(0, 0, 0, 0.35) 65%,
    transparent 100%
  );
}

body.referrer-mobile .darkening-overlay.level-4,
body.referrer-mobile .darkening-overlay.level-5 {
  background: radial-gradient(
    ellipse at right center,
    rgba(0, 0, 0, 0.5),
    rgba(0, 0, 0, 0.32) 70%,
    transparent 100%
  );
}

body.referrer-mobile .burst-beam {
  right: -18vw;
  top: -12vh;
  width: 135vw;
  height: 110vh;
}

body.referrer-mobile .darkening-hole {
  width: 220px;
  height: 72px;
}

body.referrer-mobile .light-ray {
  width: 72vw;
  filter: blur(18px);
}

body.referrer-mobile .ref-sidebar.mythic-entrance {
  right: calc(-1 * min(240px, 72vw));
}

body.referrer-mobile .ref-sidebar.mythic-entrance.stage-float {
  right: min(18px, 5vw);
}

body.referrer-mobile .ref-sidebar.mythic-entrance.stage-expand {
  width: min(90vw, 460px);
  left: 50%;
  right: auto;
  transform: translate(-50%, -50%) scale(1.02);
}

body.referrer-stage-active {
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
}

body.referrer-stage-active > :not(#referrerStageRoot):not(script):not(style) {
  pointer-events: none !important;
}

.referrer-stage-root {
  position: fixed;
  inset: 0;
  z-index: 2147483600;
  pointer-events: none;
  display: block;
}

.referrer-stage-root.active {
  pointer-events: auto;
}

@media (max-width: 540px) {
  body.referrer-mobile {
    --ref-light-beam-target-width: clamp(340px, 140vw, 520px);
    --ref-light-beam-target-height: clamp(220px, 62vh, 320px);
  }

  body.referrer-mobile .edge-impact {
    right: -32vw;
    width: 90vw;
  }

  body.referrer-mobile .darkening-overlay {
    right: -42vw;
    width: 120vw;
  }

  body.referrer-mobile .burst-beam {
    right: -24vw;
    width: 150vw;
  }
}

.celli-ref-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: none;
}

.celli-ref-overlay[aria-hidden="true"] {
  display: none !important;
}

.celli-ref-overlay[aria-hidden="false"] {
  display: flex;
}

.celli-ref-overlay.blackout-stage {
  background: #000;
  transition: background 0.6s ease;
}

.celli-ref-overlay.blackout-stage .celli-ref-mask,
.celli-ref-overlay.blackout-stage .celli-ref-panel {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.celli-ref-overlay.blackout-stage.blackout-active .celli-ref-mask,
.celli-ref-overlay.blackout-stage.blackout-active .celli-ref-panel {
  visibility: hidden;
}

.celli-ref-mask {
  position: absolute;
  inset: 0;
  background: transparent;
  backdrop-filter: none;
}

.celli-ref-panel {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  background: #0b0b10;
  overflow: visible; /* Allow flash effects to extend beyond */
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  gap: 0;
  isolation: isolate;
  z-index: 2147483200; /* Keep reconstructed layout beneath global shadow */
}

.referral-fade {
  opacity: 0 !important;
  transform: scale(0.96);
  pointer-events: none !important;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.referral-hidden {
  display: none !important;
}

body.referrer-blackout {
  background-color: #000;
  color: #f2f2f7;
  transition: background-color 0.8s ease, color 0.8s ease;
}

.ref-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  /* Header always visible now - only HN bar hides */
}

.celli-ref-panel > .ref-header,
.celli-ref-panel > .ref-list,
.celli-ref-panel > .ref-footer {
  width: 100%;
  max-width: none;
  margin: 0;
}

.ref-logo {
  width: 44px;
  height: 28px;
  border-radius: 4px;
  overflow: hidden;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 12px;
}

.ref-logo.hn {
  background: #ff6600;
  color: #000;
}

.ref-logo.reddit {
  background: #ff4500;
  color: #fff;
}

.ref-logo.twitter {
  background: #1da1f2;
  color: #fff;
  font-size: 18px;
}

.ref-logo.facebook {
  background: #1877f2;
  color: #fff;
  font-size: 20px;
  font-family: Arial, sans-serif;
}

.ref-logo.linkedin {
  background: #0a66c2;
  color: #fff;
  font-size: 18px;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-weight: 700;
}

.ref-meta {
  display: flex;
  flex-direction: column;
}

.ref-title {
  font-weight: 700;
}

.ref-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, .6);
}

.ref-close {
  margin-left: auto;
  background: #191a23;
  border: 0;
  color: #ddd;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.ref-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: visible; /* Allow horizontal effects to extend */
  padding: 0;
  display: block;
  position: relative;
  margin: 0;
  width: 100%;
  max-width: none;
}

/* === Device specific layout modes ===================================== */
.celli-ref-overlay.ref-mode-desktop {
  align-items: stretch;
}

.celli-ref-overlay.ref-mode-desktop .celli-ref-panel {
  max-width: 100vw;
  margin: 0;
  border-radius: 0;
  box-shadow: none;
}

.celli-ref-overlay.ref-mode-desktop .ref-header,
.celli-ref-overlay.ref-mode-desktop .ref-footer {
  border-radius: 0;
}

.celli-ref-overlay.ref-mode-mobile {
  align-items: stretch;
  justify-content: flex-end;
}

.celli-ref-overlay.ref-mode-mobile .celli-ref-panel {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  border-radius: 0;
  padding: 0;
  gap: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  background: radial-gradient(circle at top right, rgba(46, 43, 79, 0.32), transparent 64%), #0b0b10;
  box-shadow: none;
}

.celli-ref-overlay.ref-mode-mobile .ref-header {
  position: sticky;
  top: 0;
  z-index: 10;
  width: 100%;
  padding: clamp(18px, 6vw, 26px);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: clamp(10px, 4vw, 14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(11, 11, 16, 0.98), rgba(11, 11, 16, 0.78));
  backdrop-filter: blur(18px);
}

.celli-ref-overlay.ref-mode-mobile .ref-logo {
  width: clamp(48px, 12vw, 60px);
  height: clamp(32px, 9vw, 42px);
  font-size: clamp(12px, 4vw, 16px);
  border-radius: 6px;
  flex: 0 0 auto;
}

.celli-ref-overlay.ref-mode-mobile .ref-meta {
  width: auto;
  flex: 1 1 180px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.celli-ref-overlay.ref-mode-mobile .ref-title {
  font-size: clamp(18px, 5vw, 22px);
}

.celli-ref-overlay.ref-mode-mobile .ref-sub {
  font-size: clamp(12px, 3.5vw, 14px);
}

.celli-ref-overlay.ref-mode-mobile .ref-close {
  flex: 0 0 auto;
  margin-left: auto;
  width: auto;
  font-size: clamp(14px, 4vw, 16px);
  padding: clamp(10px, 3.6vw, 14px) clamp(16px, 5vw, 20px);
  border-radius: 12px;
  background: rgba(25, 26, 35, 0.95);
}

@media (max-width: 520px) {
  .celli-ref-overlay.ref-mode-mobile .ref-close {
    flex-basis: 100%;
    margin-left: 0;
    text-align: center;
  }
}

.celli-ref-overlay.ref-mode-mobile .ref-list {
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 5vw, 20px);
  padding: clamp(18px, 6vw, 28px);
  overflow: visible;
  scrollbar-gutter: stable;
}

.celli-ref-overlay.ref-mode-mobile .ref-item {
  padding: clamp(14px, 4.6vw, 22px);
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.celli-ref-overlay.ref-mode-mobile .ref-item h4 {
  font-size: clamp(15px, 4.8vw, 18px);
  margin-bottom: 8px;
}

.celli-ref-overlay.ref-mode-mobile .ref-item p {
  font-size: clamp(13px, 4vw, 15px);
  line-height: 1.4;
}

.celli-ref-overlay.ref-mode-mobile .ref-footer {
  position: sticky;
  bottom: 0;
  z-index: 9;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: clamp(12px, 4.4vw, 18px);
  padding: clamp(18px, 6vw, 28px);
  padding-bottom: calc(clamp(18px, 6vw, 28px) + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(11, 11, 16, 0.62), rgba(11, 11, 16, 0.96));
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(20px);
}

.celli-ref-overlay.ref-mode-mobile .ref-footer .ref-controls {
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 3.8vw, 14px);
}

.celli-ref-overlay.ref-mode-mobile .ref-footer .btn {
  width: 100%;
}

.celli-ref-overlay.ref-mode-mobile .ref-tooltip {
  display: none;
}

/* === Link Tooltip === */
.ref-tooltip {
  position: fixed;
  --edge-distance: 1500px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, .9);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  pointer-events: none;
  z-index: 2147484000;
  opacity: 0;
  transition: opacity .2s;
  white-space: nowrap;
  width: auto;
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .5);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ref-tooltip-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.ref-tooltip-bullet {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
  transition: transform .2s ease, box-shadow .2s ease;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}

.ref-tooltip--hn .ref-tooltip-bullet {
  width: 16px;
  height: 12px;
  border-radius: 5px;
  background: linear-gradient(140deg, #ffba70, #ff6600);
  box-shadow: 0 0 14px rgba(255, 102, 0, 0.6);
  transform: translateY(-1px);
}

.ref-tooltip--hn .ref-tooltip-bullet::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 9px;
  height: 6px;
  background: inherit;
  clip-path: polygon(50% 100%, 0 0, 100% 0);
  border-radius: 1px;
  box-shadow: 0 0 10px rgba(255, 102, 0, 0.45);
}

.ref-tooltip--reddit .ref-tooltip-bullet {
  background: #ff4500;
  box-shadow: 0 0 10px rgba(255, 69, 0, 0.6);
}

.ref-tooltip--twitter .ref-tooltip-bullet {
  width: 28px;
  height: 16px;
  border-radius: 999px;
  padding: 0 6px;
  gap: 4px;
  background: linear-gradient(135deg, #38c8ff, #1da1f2);
  box-shadow: 0 0 16px rgba(29, 161, 242, 0.65);
  color: #ecf9ff;
  font-size: 11px;
  letter-spacing: -0.5px;
}

.ref-tooltip--twitter .ref-tooltip-bullet::before,
.ref-tooltip--twitter .ref-tooltip-bullet::after {
  content: '';
  position: relative;
  display: inline-block;
}

.ref-tooltip--twitter .ref-tooltip-bullet::before {
  content: '❤';
  color: #ffd5ec;
  font-size: 12px;
  transform: translateY(-0.5px);
}

.ref-tooltip--twitter .ref-tooltip-bullet::after {
  content: '🔁';
  color: #dcf4ff;
  font-size: 11px;
  transform: translateY(0.5px);
}

.ref-tooltip--facebook .ref-tooltip-bullet {
  width: 28px;
  height: 16px;
  border-radius: 10px;
  padding: 0 6px;
  gap: 4px;
  background: linear-gradient(135deg, #5aa7ff, #1877f2);
  box-shadow: 0 0 16px rgba(24, 119, 242, 0.65);
  color: #f3f6ff;
  font-size: 11px;
}

.ref-tooltip--facebook .ref-tooltip-bullet::before,
.ref-tooltip--facebook .ref-tooltip-bullet::after {
  content: '';
  position: relative;
  display: inline-block;
}

.ref-tooltip--facebook .ref-tooltip-bullet::before {
  content: '👍';
  font-size: 12px;
  color: #ffffff;
  transform: translateY(-0.5px);
}

.ref-tooltip--facebook .ref-tooltip-bullet::after {
  content: '🙏';
  font-size: 11px;
  color: #ffe8a3;
  transform: translateY(0.5px);
}

.ref-tooltip--linkedin .ref-tooltip-bullet {
  background: #0a66c2;
  box-shadow: 0 0 10px rgba(10, 102, 194, 0.6);
}

.hearts-prayers-toast {
  position: fixed;
  transform: translate(-50%, -10px) scale(0.92);
  opacity: 0;
  background: rgba(17, 17, 17, 0.92);
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  z-index: 2147485000;
  transition: opacity .18s ease, transform .18s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.hearts-prayers-toast.visible {
  opacity: 1;
  transform: translate(-50%, -44px) scale(1);
}

.hearts-prayers-toast--hn {
  background: rgba(255, 102, 0, 0.95);
}

.hearts-prayers-toast--reddit {
  background: rgba(255, 69, 0, 0.95);
}

.hearts-prayers-toast--twitter {
  background: rgba(29, 161, 242, 0.92);
}

.hearts-prayers-toast--facebook {
  background: rgba(24, 119, 242, 0.92);
}

.hearts-prayers-toast--linkedin {
  background: rgba(10, 102, 194, 0.92);
}

.ref-tooltip.active {
  opacity: 1;
}

.ref-tooltip.morphing {
  animation: splatToEdge 0.7s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

.ref-tooltip.charging {
  animation: tooltipChargePrep 0.28s ease-in-out alternate infinite;
}

.ref-tooltip.charging .ref-tooltip-bullet {
  animation: tooltipChargePulse 0.28s ease-in-out alternate infinite;
  box-shadow: 0 0 12px rgba(132, 192, 255, 0.65), 0 0 26px rgba(255, 255, 255, 0.18);
}

@keyframes splatToEdge {
  0% {
    transform: translate(0, 0) scale(1, 1) rotate(0deg);
    opacity: 1;
  }
  5% {
    transform: translate(-3px, 0) scale(1.05, 0.95) rotate(-2deg);
    opacity: 1;
  }
  10% {
    transform: translate(5px, 0) scale(0.95, 1.05) rotate(3deg);
    opacity: 1;
  }
  15% {
    transform: translate(-2px, 0) scale(1.02, 0.98) rotate(-1deg);
    opacity: 1;
  }
  20% {
    transform: translate(0, 0) scale(1, 1) rotate(0deg);
    opacity: 1;
  }
  /* Acceleration phase */
  30% {
    transform: translate(calc(var(--edge-distance) * 0.2), 0) scale(1.1, 1) rotate(0deg);
    opacity: 1;
  }
  50% {
    transform: translate(calc(var(--edge-distance) * 0.45), 0) scale(1.3, 1) rotate(0deg);
    opacity: 1;
  }
  75% {
    transform: translate(calc(var(--edge-distance) * 0.75), 0) scale(1.6, 0.9) rotate(0deg);
    opacity: 1;
  }
  90% {
    transform: translate(calc(var(--edge-distance) * 0.92), 0) scale(2, 0.7) rotate(0deg);
    opacity: 1;
  }
  /* Impact and squish */
  95% {
    transform: translate(calc(var(--edge-distance) * 1), 0) scale(0.3, 2) rotate(0deg);
    opacity: 0.8;
  }
  100% {
    transform: translate(calc(var(--edge-distance) * 1.08), 0) scale(0.1, 2.5) rotate(0deg);
    opacity: 0;
  }
}

@keyframes tooltipChargePrep {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(0, -2px) scale(1.03);
  }
}

@keyframes tooltipChargePulse {
  0% {
    transform: scale(1);
  }
  100% {
    transform: scale(1.55);
  }
}

@keyframes badBooleanClubSpin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

@keyframes badBooleanLightSweep {
  0% {
    opacity: 0;
    transform: scale(0.6) translate(-20%, -20%);
  }
  40% {
    opacity: 0.75;
    transform: scale(1.1) translate(20%, 20%);
  }
  100% {
    opacity: 0;
    transform: scale(1.4) translate(40%, 40%);
  }
}

.ref-item {
  background: linear-gradient(180deg, rgba(255, 255, 255, .03), rgba(255, 255, 255, .015));
  border: 1px solid rgba(255, 255, 255, .05);
  border-radius: 10px;
  padding: 12px;
  transition: transform .12s ease, opacity .2s ease;
  cursor: pointer;
}

.ref-item h4 {
  margin: 0 0 6px 0;
  font-size: 14px;
  line-height: 1.15;
}

.ref-item p {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, .55);
}

.ref-item:hover {
  transform: translateY(-1px);
}

/* === Reddit faithful reconstruction === */
.ref-list.reddit-style {
  display: block;
  padding: 0;
  background: #eff7ff;
  font-family: Verdana, Geneva, sans-serif;
}

.celli-ref-overlay.ref-mode-mobile .ref-list.reddit-style {
  display: block;
  padding: clamp(16px, 5vw, 22px) clamp(16px, 5vw, 22px) clamp(60px, 12vw, 96px);
}

.celli-ref-overlay.ref-mode-mobile .reddit-header {
  flex-wrap: wrap;
  gap: clamp(8px, 4vw, 14px);
  padding: clamp(12px, 5vw, 18px);
}

.celli-ref-overlay.ref-mode-mobile .reddit-post {
  flex-direction: column;
  margin: 0 0 clamp(12px, 4.6vw, 18px);
  padding: clamp(14px, 4.6vw, 20px);
  border-radius: 18px;
}

.celli-ref-overlay.ref-mode-mobile .reddit-vote {
  flex-direction: row;
  width: 100%;
  justify-content: flex-start;
  gap: clamp(10px, 4vw, 16px);
}

.celli-ref-overlay.ref-mode-mobile .reddit-main {
  width: 100%;
}

.reddit-header {
  background: #cee3f8;
  border-bottom: 1px solid #5f99cf;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.reddit-logo {
  width: 120px;
  height: 40px;
  background: #ff4500;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: bold;
  font-size: 20px;
  font-family: Verdana, sans-serif;
}

.reddit-nav {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: #369;
}

.reddit-nav a {
  color: #369;
  text-decoration: none;
  font-weight: bold;
}

.reddit-nav a:hover {
  text-decoration: underline;
}

.reddit-content {
  padding: 10px 0;
}

.reddit-post {
  background: white;
  border: 1px solid #c7d9e8;
  margin: 0 10px 10px 10px;
  padding: 8px;
  display: flex;
  gap: 8px;
  font-size: 11px;
  position: relative;
  transition: background 0.1s;
}

.reddit-post.glitching {
  animation: hnGlitch 0.8s steps(8) 1;
  background: rgba(255, 69, 0, 0.1);
  z-index: 10;
}

.reddit-post.glitching::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: rgba(255, 0, 0, 0.2);
  filter: blur(4px);
  opacity: 0;
  animation: glitchFlash 0.8s steps(4) 1;
}

.reddit-post.glitching::after {
  content: '';
  position: absolute;
  inset: -2px;
  background: rgba(0, 255, 255, 0.2);
  filter: blur(4px);
  opacity: 0;
  animation: glitchFlash 0.8s steps(4) 1 0.1s;
}

.reddit-post.has-celli-ad {
  background: linear-gradient(90deg,
    rgba(102, 126, 234, 0.03),
    rgba(118, 75, 162, 0.06),
    rgba(102, 126, 234, 0.03));
  background-size: 120% 100%;
  border-left: 3px solid rgba(102, 126, 234, 0.4);
}

.reddit-vote {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 30px;
  flex-shrink: 0;
}

.reddit-arrow {
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  cursor: pointer;
  opacity: 0.6;
}

.reddit-arrow.up {
  border-bottom: 7px solid #c6c6c6;
  margin-bottom: 2px;
}

.reddit-arrow.down {
  border-top: 7px solid #c6c6c6;
  margin-top: 2px;
}

.reddit-arrow:hover {
  opacity: 1;
}

.reddit-score {
  font-weight: bold;
  color: #c6c6c6;
  font-size: 10px;
}

.reddit-thumbnail {
  width: 70px;
  height: 70px;
  flex-shrink: 0;
  background: #f0f0f0;
  border: 1px solid #c7d9e8;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 10px;
  position: relative;
  overflow: hidden;
}

.reddit-thumbnail.broken-image::before {
  content: '';
  position: absolute;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, transparent 45%, #999 45%, #999 55%, transparent 55%);
}

.reddit-thumbnail.broken-image::after {
  content: '';
  position: absolute;
  width: 30px;
  height: 30px;
  border: 2px solid #999;
  border-radius: 50%;
  top: 8px;
  left: 8px;
}

.reddit-main {
  flex: 1;
  min-width: 0;
}

.reddit-title {
  margin: 0 0 4px 0;
}

.reddit-title a {
  color: #0000ff;
  text-decoration: none;
  font-size: 12px;
  cursor: pointer !important;
}

.reddit-title a:visited {
  color: #551a8b;
}

.reddit-title a:hover {
  text-decoration: underline;
}

.reddit-title a.parodied {
  color: #ff4500;
  font-weight: bold;
}

.reddit-title a.celli-ad {
  color: #667eea;
  font-weight: bold;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #667eea 100%);
  background-size: 150% 100%;
  background-position: center;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.reddit-domain {
  color: #888;
  font-size: 10px;
  margin-left: 4px;
}

.reddit-meta {
  font-size: 10px;
  color: #888;
  margin: 4px 0;
}

.reddit-meta a {
  color: #888;
  text-decoration: none;
  font-weight: bold;
}

.reddit-meta a:hover {
  text-decoration: underline;
}

.reddit-subreddit {
  color: #369;
  font-weight: bold;
}

/* === Modern X/Twitter (Zeed) === */
.ref-list.twitter-style {
  display: grid;
  grid-template-columns: 275px 1fr 350px;
  padding: 0;
  background: #000;
  color: #e7e9ea;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  height: 100%;
  overflow: hidden;
}

.twitter-sidebar {
  background: #000;
  border-right: 1px solid #2f3336;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.twitter-logo {
  color: #e7e9ea;
  font-size: 28px;
  font-weight: 700;
  padding: 12px;
  margin-bottom: 8px;
}

.twitter-nav-item {
  padding: 12px 16px;
  border-radius: 24px;
  font-size: 20px;
  font-weight: 400;
  color: #e7e9ea;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 20px;
}

.twitter-nav-item:hover {
  background: #16181c;
}

.twitter-post-btn {
  background: #1d9bf0;
  color: white;
  border: none;
  border-radius: 24px;
  padding: 14px 24px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 16px;
  width: 100%;
}

.twitter-feed {
  background: #000;
  border-right: 1px solid #2f3336;
  overflow-y: auto;
  overflow-x: hidden;
}

.celli-ref-overlay.ref-mode-mobile .ref-list.twitter-style {
  display: block;
  padding: clamp(12px, 5vw, 18px);
}

.celli-ref-overlay.ref-mode-mobile .twitter-sidebar,
.celli-ref-overlay.ref-mode-mobile .twitter-right-panel {
  display: none;
}

.celli-ref-overlay.ref-mode-mobile .twitter-feed {
  border-right: none;
  margin: 0;
  padding: clamp(6px, 4vw, 12px) 0 clamp(48px, 12vw, 84px);
}

.celli-ref-overlay.ref-mode-mobile .twitter-tweet {
  margin: 0;
  border-radius: 20px;
  padding: clamp(16px, 4.6vw, 22px);
}

.twitter-feed-header {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #2f3336;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
}

.twitter-tab {
  flex: 1;
  padding: 16px;
  text-align: center;
  font-weight: 500;
  color: #71767b;
  cursor: pointer;
  border-bottom: 4px solid transparent;
  transition: background 0.2s;
}

.twitter-tab.active {
  font-weight: 700;
  color: #e7e9ea;
  border-bottom-color: #1d9bf0;
}

.twitter-tab:hover {
  background: rgba(231, 233, 234, 0.1);
}

.twitter-compose {
  border-bottom: 1px solid #2f3336;
  padding: 12px 16px;
  display: flex;
  gap: 12px;
}

.twitter-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #333;
  flex-shrink: 0;
}

.twitter-compose-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #e7e9ea;
  font-size: 20px;
  outline: none;
}

.twitter-compose-input::placeholder {
  color: #71767b;
}

.twitter-content {
  padding: 0;
}

.twitter-tweet {
  border-bottom: 1px solid #2f3336;
  padding: 12px 16px;
  background: #000;
  transition: background 0.1s;
  position: relative;
  display: flex;
  gap: 12px;
}

.twitter-tweet:hover {
  background: rgba(255, 255, 255, 0.03);
}

.twitter-tweet.glitching {
  animation: hnGlitch 0.8s steps(8) 1;
  background: rgba(29, 161, 242, 0.1);
  z-index: 10;
}

.twitter-tweet.glitching::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: rgba(29, 161, 242, 0.3);
  filter: blur(4px);
  opacity: 0;
  animation: glitchFlash 0.8s steps(4) 1;
}

.twitter-tweet.glitching::after {
  content: '';
  position: absolute;
  inset: -2px;
  background: rgba(0, 255, 255, 0.2);
  filter: blur(4px);
  opacity: 0;
  animation: glitchFlash 0.8s steps(4) 1 0.1s;
}

.twitter-tweet.has-celli-ad {
  background: linear-gradient(90deg,
    rgba(102, 126, 234, 0.03),
    rgba(118, 75, 162, 0.06),
    rgba(102, 126, 234, 0.03));
  background-size: 120% 100%;
  border-left: 3px solid rgba(102, 126, 234, 0.4);
}

.twitter-tweet-content {
  flex: 1;
}

.twitter-user {
  font-weight: 700;
  color: #e7e9ea;
  font-size: 15px;
}

.twitter-handle {
  color: #71767b;
  font-size: 15px;
  font-weight: 400;
  margin-left: 4px;
}

.twitter-time {
  color: #71767b;
  font-size: 15px;
  margin-left: 4px;
}

.twitter-text {
  color: #e7e9ea;
  font-size: 15px;
  margin: 4px 0 12px 0;
  line-height: 1.3;
  cursor: pointer !important;
}

.twitter-text.parodied {
  color: #ff4500;
  font-weight: 600;
}

.twitter-text.celli-ad {
  background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #667eea 100%);
  background-size: 150% 100%;
  background-position: center;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

.twitter-actions {
  display: flex;
  gap: 80px;
  color: #71767b;
  font-size: 13px;
  margin-top: 8px;
}

.twitter-action {
  cursor: pointer;
  transition: color 0.2s;
}

.twitter-action:hover {
  color: #1d9bf0;
}

.twitter-right-panel {
  background: #000;
  padding: 8px 16px;
  overflow-y: auto;
}

.twitter-widget {
  background: #16181c;
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 16px;
}

.twitter-widget-title {
  font-size: 20px;
  font-weight: 800;
  color: #e7e9ea;
  margin-bottom: 12px;
}

.twitter-trend {
  padding: 12px 0;
  cursor: pointer;
  transition: background 0.2s;
}

.twitter-trend:hover {
  background: rgba(255, 255, 255, 0.03);
}

.twitter-trend-category {
  font-size: 13px;
  color: #71767b;
}

.twitter-trend-name {
  font-size: 15px;
  font-weight: 700;
  color: #e7e9ea;
  margin: 2px 0;
}

.twitter-trend-posts {
  font-size: 13px;
  color: #71767b;
}

/* === Facebook faithful reconstruction === */
.ref-list.facebook-style {
  display: grid;
  grid-template-columns: 1fr 300px;
  padding: 0;
  background: #e4e6eb;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  gap: 0;
}

.facebook-header {
  background: #1877f2;
  padding: 8px 16px;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #1467d3;
}

.facebook-logo {
  color: white;
  font-size: 28px;
  font-weight: bold;
  font-family: "Klavika", sans-serif;
}

.facebook-search {
  flex: 1;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 20px;
  padding: 8px 16px;
  color: white;
  font-size: 14px;
}

.facebook-feed {
  background: #f0f2f5;
  padding: 16px;
  overflow-y: auto;
}

.celli-ref-overlay.ref-mode-mobile .ref-list.facebook-style {
  display: block;
  padding: clamp(12px, 5vw, 18px);
}

.celli-ref-overlay.ref-mode-mobile .facebook-feed {
  padding: clamp(12px, 4.6vw, 18px) clamp(12px, 4.6vw, 18px) clamp(48px, 12vw, 84px);
}

.celli-ref-overlay.ref-mode-mobile .facebook-post {
  margin-bottom: clamp(14px, 4.8vw, 22px);
  border-radius: 18px;
  padding-bottom: clamp(12px, 3.6vw, 18px);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.18);
}

.facebook-post {
  background: white;
  border-radius: 8px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  position: relative;
}

.facebook-post.glitching {
  animation: hnGlitch 0.8s steps(8) 1;
  background: rgba(24, 119, 242, 0.1);
  z-index: 10;
}

.facebook-post.glitching::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: rgba(24, 119, 242, 0.3);
  filter: blur(4px);
  opacity: 0;
  animation: glitchFlash 0.8s steps(4) 1;
}

.facebook-post.glitching::after {
  content: '';
  position: absolute;
  inset: -2px;
  background: rgba(0, 255, 255, 0.2);
  filter: blur(4px);
  opacity: 0;
  animation: glitchFlash 0.8s steps(4) 1 0.1s;
}

.facebook-post.has-celli-ad {
  background: linear-gradient(135deg,
    rgba(102, 126, 234, 0.05),
    rgba(118, 75, 162, 0.08));
  background-size: 120% 100%;
  border-left: 4px solid rgba(102, 126, 234, 0.5);
}

.facebook-post-header {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.facebook-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #d0d0d0;
  flex-shrink: 0;
}

.facebook-user {
  font-weight: 600;
  color: #050505;
  font-size: 15px;
}

.facebook-time {
  color: #65676b;
  font-size: 13px;
}

.facebook-post-text {
  padding: 0 16px 12px 16px;
  color: #050505;
  font-size: 15px;
  line-height: 1.3333;
  cursor: pointer !important;
}

.facebook-post-text.parodied {
  color: #ff4500;
  font-weight: 600;
}

.facebook-post-text.celli-ad {
  background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #667eea 100%);
  background-size: 150% 100%;
  background-position: center;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

/* === LinkedIn spoof === */
.ref-list.linkedin-style {
  display: grid;
  grid-template-columns: 220px 1fr 280px;
  background: #f3f2ef;
  font-family: 'Segoe UI', Arial, sans-serif;
  color: #1d1d1f;
}

.linkedin-sidebar,
.linkedin-right {
  padding: 16px;
  background: transparent;
}

.linkedin-sidebar .linkedin-card,
.linkedin-right .linkedin-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
  padding: 16px;
  margin-bottom: 12px;
}

.linkedin-sidebar .linkedin-card h4 {
  font-size: 14px;
  margin-bottom: 8px;
  color: #0a66c2;
}

.linkedin-action {
  font-size: 13px;
  color: #5f6368;
  margin-bottom: 6px;
}

.linkedin-action:last-child {
  margin-bottom: 0;
}

.linkedin-feed {
  padding: 16px 24px;
  background: transparent;
}

.celli-ref-overlay.ref-mode-mobile .ref-list.linkedin-style {
  display: block;
  padding: clamp(12px, 5vw, 18px);
}

.celli-ref-overlay.ref-mode-mobile .linkedin-sidebar,
.celli-ref-overlay.ref-mode-mobile .linkedin-right {
  width: 100%;
  padding: clamp(12px, 4.6vw, 18px) 0;
}

.celli-ref-overlay.ref-mode-mobile .linkedin-sidebar .linkedin-card,
.celli-ref-overlay.ref-mode-mobile .linkedin-right .linkedin-card {
  margin: 0 0 clamp(14px, 4.6vw, 20px);
  border-radius: 18px;
  padding: clamp(16px, 4.8vw, 22px);
}

.celli-ref-overlay.ref-mode-mobile .linkedin-feed {
  padding: clamp(14px, 4.8vw, 20px) clamp(12px, 4.6vw, 18px) clamp(48px, 12vw, 84px);
}

.celli-ref-overlay.ref-mode-mobile .linkedin-post {
  border-radius: 18px;
  margin-bottom: clamp(16px, 4.8vw, 22px);
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.16);
}

.linkedin-post {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  margin-bottom: 16px;
  overflow: hidden;
  position: relative;
}

.linkedin-post.glitching {
  animation: hnGlitch 0.75s steps(7) 1;
  background: rgba(10, 102, 194, 0.08);
}

.linkedin-post.has-celli-ad {
  border-left: 4px solid rgba(118, 75, 162, 0.55);
  background: linear-gradient(120deg, rgba(118, 75, 162, 0.06), rgba(102, 126, 234, 0.04));
}

.linkedin-post-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.linkedin-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0a66c2, #60a5fa);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
}

.linkedin-header-text {
  flex: 1;
}

.linkedin-user {
  font-weight: 600;
  font-size: 15px;
  color: #1d1d1f;
}

.linkedin-headline {
  font-size: 13px;
  color: #5f6368;
}

.linkedin-time {
  font-size: 12px;
  color: #7d7d7d;
  margin-top: 2px;
}

.linkedin-follow {
  border: 1px solid #0a66c2;
  background: transparent;
  color: #0a66c2;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
}

.linkedin-post-text {
  padding: 0 16px 16px 16px;
  font-size: 14px;
  line-height: 1.45;
  color: #1d1d1f;
  cursor: pointer !important;
}

.linkedin-post-text.parodied {
  color: #d97706;
  font-weight: 600;
}

.linkedin-post-text.celli-ad {
  background: linear-gradient(90deg, #764ba2 0%, #0a66c2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
}

.linkedin-post-footer {
  border-top: 1px solid #eef0f2;
  display: flex;
  justify-content: space-around;
  padding: 10px 16px;
  font-size: 13px;
  color: #5f6368;
}

.linkedin-post-footer span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.facebook-actions {
  border-top: 1px solid #e4e6eb;
  padding: 4px 16px;
  display: flex;
  justify-content: space-around;
}

.facebook-action {
  padding: 8px;
  color: #65676b;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.facebook-messenger {
  background: white;
  border-left: 1px solid #ddd;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.messenger-header {
  font-weight: 700;
  font-size: 16px;
  color: #050505;
  padding-bottom: 8px;
  border-bottom: 1px solid #e4e6eb;
}

.messenger-contact {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
}

.messenger-contact:hover {
  background: #f0f2f5;
}

.messenger-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #d0d0d0;
  flex-shrink: 0;
}

.messenger-name {
  font-weight: 600;
  color: #050505;
  font-size: 14px;
}

.messenger-preview {
  color: #65676b;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* === HN faithful reconstruction === */
.ref-list.hn-style {
  display: block;
  padding: 0;
  background: #f6f6ef;
}

.celli-ref-overlay.ref-mode-mobile .ref-list.hn-style {
  padding: clamp(12px, 5vw, 18px) clamp(12px, 5vw, 18px) clamp(48px, 12vw, 84px);
}

.celli-ref-overlay.ref-mode-mobile .hn-wrap {
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.16);
}

.celli-ref-overlay.ref-mode-mobile .hn-content {
  padding: clamp(12px, 4.6vw, 18px) clamp(12px, 4.6vw, 18px) clamp(18px, 5vw, 24px);
}

.hn-wrap {
  background: #ff6600;
  padding: 2px;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
  pointer-events: none;
}

.hn-wrap.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.hn-top {
  background: #ff6600;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px;
}

.hn-logo {
  width: 18px;
  height: 18px;
  border: 1px solid #fff;
  background: #fff;
  display: inline-block;
}

.hn-title {
  font-weight: bold;
  color: #000;
  font-size: 11px;
  font-family: Verdana, Geneva, sans-serif;
}

.hn-nav {
  font-size: 10px;
  color: #000;
  font-family: Verdana, Geneva, sans-serif;
  display: flex;
  gap: 8px;
}

.hn-nav a {
  color: #000;
  text-decoration: none;
}

.hn-nav a:hover {
  text-decoration: underline;
}

.hn-content {
  background: #f6f6ef;
  padding: 8px 0;
}

.hn-item {
  display: flex;
  gap: 4px;
  padding: 2px 4px;
  font-size: 10pt;
  font-family: Verdana, Geneva, sans-serif;
  line-height: 12pt;
  position: relative;
  transition: background 0.1s;
}

.hn-item.glitching {
  animation: hnGlitch 0.8s steps(8) 1;
  background: rgba(255, 100, 0, 0.2);
  position: relative;
  z-index: 10;
}

.hn-item.glitching::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: rgba(255, 0, 0, 0.3);
  filter: blur(4px);
  opacity: 0;
  animation: glitchFlash 0.8s steps(4) 1;
}

.hn-item.glitching::after {
  content: '';
  position: absolute;
  inset: -2px;
  background: rgba(0, 255, 255, 0.3);
  filter: blur(4px);
  opacity: 0;
  animation: glitchFlash 0.8s steps(4) 1 0.1s;
}

@keyframes hnGlitch {
  0% {
    transform: translate(0, 0) scaleX(1);
    opacity: 1;
    filter: hue-rotate(0deg);
  }
  8% {
    transform: translate(-8px, 2px) scaleX(0.95);
    opacity: 0.8;
    filter: hue-rotate(90deg);
  }
  16% {
    transform: translate(10px, -3px) scaleX(1.05);
    opacity: 0.5;
    filter: hue-rotate(-90deg);
  }
  24% {
    transform: translate(-6px, 4px) scaleX(0.9);
    opacity: 0.9;
    filter: hue-rotate(180deg);
  }
  32% {
    transform: translate(12px, -2px) scaleX(1.1);
    opacity: 0.3;
    filter: hue-rotate(-180deg);
  }
  40% {
    transform: translate(-10px, 3px) scaleX(0.85);
    opacity: 0.7;
    filter: hue-rotate(270deg);
  }
  48% {
    transform: translate(8px, -4px) scaleX(1.15);
    opacity: 0.4;
    filter: hue-rotate(-270deg);
  }
  56% {
    transform: translate(-12px, 1px) scaleX(0.8);
    opacity: 0.6;
    filter: hue-rotate(45deg);
  }
  64% {
    transform: translate(15px, -1px) scaleX(1.2);
    opacity: 0.2;
    filter: hue-rotate(-45deg);
  }
  72% {
    transform: translate(-5px, 3px) scaleX(0.92);
    opacity: 0.8;
    filter: hue-rotate(135deg);
  }
  80% {
    transform: translate(7px, -2px) scaleX(1.08);
    opacity: 0.5;
    filter: hue-rotate(-135deg);
  }
  88% {
    transform: translate(-3px, 1px) scaleX(0.96);
    opacity: 0.9;
    filter: hue-rotate(225deg);
  }
  96% {
    transform: translate(2px, -1px) scaleX(1.02);
    opacity: 0.95;
    filter: hue-rotate(-225deg);
  }
  100% {
    transform: translate(0, 0) scaleX(1);
    opacity: 1;
    filter: hue-rotate(0deg);
  }
}

@keyframes glitchFlash {
  0%, 100% {
    opacity: 0;
  }
  25%, 75% {
    opacity: 0.8;
  }
  50% {
    opacity: 0.2;
  }
}

@keyframes flashFade {
  0% {
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.hn-story-title.parodied {
  color: #ff4500;
  font-weight: bold;
}

.hn-story-title.celli-ad {
  color: #667eea;
  font-weight: bold;
  background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #667eea 100%);
  background-size: 150% 100%;
  background-position: center;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

@keyframes celliShimmer {
  0% {
    background-position: 0% center;
  }
  100% {
    background-position: 200% center;
  }
}

.hn-item.has-celli-ad {
  background: linear-gradient(90deg,
    rgba(102, 126, 234, 0.05),
    rgba(118, 75, 162, 0.08),
    rgba(102, 126, 234, 0.05));
  background-size: 120% 100%;
  border-left: 2px solid rgba(102, 126, 234, 0.3);
}

@keyframes celliGlow {
  0%, 100% {
    background-position: 0% center;
    box-shadow: 0 0 0 rgba(102, 126, 234, 0);
  }
  50% {
    background-position: 100% center;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.2);
  }
}

.hn-rank {
  color: #828282;
  text-align: right;
  min-width: 25px;
  font-size: 10pt;
}

.hn-vote {
  width: 12px;
  display: flex;
  align-items: flex-start;
  padding-top: 2px;
}

.hn-vote-arrow {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 6px solid #828282;
  cursor: pointer;
  opacity: .6;
}

.hn-vote-arrow:hover {
  opacity: 1;
}

.hn-main {
  flex: 1;
  min-width: 0;
}

.hn-titleline {
  display: flex;
  gap: 6px;
  align-items: baseline;
}

.hn-story-title {
  color: #000;
  text-decoration: none;
  font-size: 10pt;
  cursor: pointer !important;
}

.hn-story-title:hover {
  text-decoration: underline;
}

.hn-story-title:visited {
  color: #828282;
}

.hn-sitebit {
  font-size: 8pt;
  color: #828282;
}

.hn-sitebit a {
  color: #828282;
  text-decoration: none;
}

.hn-sitebit a:hover {
  text-decoration: underline;
}

.hn-subtext {
  font-size: 7pt;
  color: #828282;
  padding: 2px 0 4px 0;
}

.hn-subtext a {
  color: #828282;
  text-decoration: none;
}

.hn-subtext a:hover {
  text-decoration: underline;
}

.hn-spacer {
  height: 5px;
  background: #ff6600;
}

/* === Sidebar Ad === */
.ref-sidebar {
  position: fixed;
  right: -320px;
  top: 50%;
  transform: translateY(-50%);
  width: 300px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px 0 0 12px;
  box-shadow: -8px 0 40px rgba(0, 0, 0, .4);
  padding: 20px;
  color: #fff;
  z-index: 2147483600; /* Keep crystalline invites above light effects */
  transition: right .4s cubic-bezier(.68, -.55, .265, 1.55);
}

.ref-sidebar.active {
  right: 0;
}

.ref-sidebar-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, .2);
  border: 0;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.ref-sidebar-close:hover {
  background: rgba(0, 0, 0, .4);
}

.ref-sidebar h3 {
  margin: 0 0 12px 0;
  font-size: 18px;
  font-weight: 700;
}

.ref-sidebar p {
  margin: 0 0 16px 0;
  font-size: 14px;
  line-height: 1.4;
  opacity: .9;
}

.ref-sidebar.badboolean-party {
  position: relative;
  overflow: hidden;
  animation: badBooleanClubSpin 9s linear infinite;
}

.ref-sidebar.badboolean-party::before,
.ref-sidebar.badboolean-party::after {
  content: '';
  position: absolute;
  inset: -45%;
  background: conic-gradient(from 0deg, rgba(255, 0, 204, 0.18), rgba(0, 255, 204, 0.14), rgba(255, 255, 0, 0.12), rgba(255, 0, 204, 0.18));
  mix-blend-mode: screen;
  pointer-events: none;
  opacity: 0.55;
  animation: badBooleanClubSpin 6s linear infinite;
}

.ref-sidebar.badboolean-party::after {
  animation-direction: reverse;
  animation-duration: 8s;
  opacity: 0.35;
}

.ref-sidebar-btn {
  background: transparent;
  color: inherit;
  border: none;
  padding: 0;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  font-size: 14px;
  transition: transform 0.2s ease, filter 0.2s ease;
  position: relative;
  overflow: hidden;
  display: block;
  text-align: left;
  z-index: 2;
}

.ref-sidebar-btn.magnetic-highlight {
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.2s ease;
}

.ref-sidebar-btn.badboolean-party {
  overflow: hidden;
  position: relative;
}

.ref-sidebar-btn.badboolean-party::before,
.ref-sidebar-btn.badboolean-party::after {
  content: '';
  position: absolute;
  inset: -30%;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.12), transparent 60%);
  mix-blend-mode: screen;
  opacity: 0;
  animation: badBooleanLightSweep 2.6s ease-in-out infinite;
}

.ref-sidebar-btn.badboolean-party::after {
  animation-delay: 1.3s;
}

.badboolean-banner {
  width: 100%;
  text-align: center;
}

.badboolean-wave-line {
  display: inline-flex;
  gap: 0.08em;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.celli-ref-overlay.ref-mode-mobile .ref-sidebar {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-height: min(82vh, 620px);
  border-radius: 28px 28px 0 0;
  padding: clamp(22px, 7vw, 30px);
  transform: translateY(110%);
  box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.55);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  overflow-y: auto;
}

.celli-ref-overlay.ref-mode-mobile .ref-sidebar.active {
  transform: translateY(0);
}

.celli-ref-overlay.ref-mode-mobile .ref-sidebar-close {
  top: clamp(18px, 6vw, 26px);
  right: clamp(18px, 6vw, 26px);
  width: clamp(28px, 8vw, 36px);
  height: clamp(28px, 8vw, 36px);
  font-size: clamp(16px, 5vw, 20px);
  background: rgba(0, 0, 0, 0.28);
}

.celli-ref-overlay.ref-mode-mobile .ref-sidebar h3 {
  text-align: center;
  font-size: clamp(18px, 5.4vw, 22px);
  margin-bottom: clamp(12px, 4vw, 18px);
}

.celli-ref-overlay.ref-mode-mobile .ref-sidebar p {
  font-size: clamp(13px, 4vw, 16px);
}

.celli-ref-overlay.ref-mode-mobile .ref-sidebar-btn {
  margin: clamp(10px, 4vw, 18px) 0;
  padding: clamp(20px, 6vw, 28px);
  border-radius: clamp(18px, 6vw, 26px);
  background: rgba(0, 0, 0, 0.22);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.35);
}

.badboolean-wave-char {
  display: inline-block;
  --wave-level: 0;
  transform: translateY(calc(var(--wave-level) * -14px)) scaleY(calc(1 + var(--wave-level) * 0.6));
  transition: transform 0.1s ease, text-shadow 0.16s ease, color 0.2s ease;
  text-shadow: 0 0 calc(18px * var(--wave-level) + 2px) rgba(255, 255, 255, 0.7);
}

.badboolean-ambient {
  position: absolute;
  inset: -8%;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.6s ease;
  filter: blur(0.4px);
}

.badboolean-ambient.is-active {
  opacity: 0.65;
}

.badboolean-ambient__char {
  position: absolute;
  top: var(--ambient-top, 50%);
  left: var(--ambient-left, 50%);
  transform: translate(-50%, -50%) rotate(var(--ambient-rotation, 0deg));
  font-family: 'Roboto Mono', ui-monospace, monospace;
  font-size: clamp(11px, 3.2vw, 18px);
  letter-spacing: 0.08em;
  color: rgba(182, 225, 255, 0.24);
  text-shadow: 0 0 12px rgba(143, 180, 255, 0.45);
  animation: badBooleanAmbientFloat var(--ambient-duration, 6s) ease-in-out infinite;
  mix-blend-mode: screen;
  opacity: var(--ambient-opacity, 0.6);
}

@keyframes badBooleanAmbientFloat {
  0% {
    transform: translate(-50%, -50%) rotate(var(--ambient-rotation, 0deg));
  }
  50% {
    transform: translate(calc(-50% + var(--ambient-drift-x, 6px)), calc(-50% + var(--ambient-drift-y, -4px))) rotate(calc(var(--ambient-rotation, 0deg) + 6deg));
  }
  100% {
    transform: translate(calc(-50% + var(--ambient-drift-x, 6px) * -1), calc(-50% + var(--ambient-drift-y, -4px) * -1)) rotate(calc(var(--ambient-rotation, 0deg) - 6deg));
  }
}

.ref-sidebar-btn:focus-visible {
  outline: 2px solid rgba(143, 180, 255, 0.9);
  outline-offset: 4px;
}

.ref-sidebar-btn.loom-invite-base {
  isolation: isolate;
  overflow: hidden;
}

.loom-invite-card__subline--audio {
  font-family: 'Roboto Mono', ui-monospace, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.62);
  transition: color 0.4s ease, text-shadow 0.4s ease, opacity 0.4s ease;
  opacity: 0.85;
}

.loom-invite-card__subline--audio[data-active="true"] {
  color: rgba(143, 180, 255, 0.92);
  text-shadow: 0 0 18px rgba(143, 180, 255, 0.55);
  opacity: 1;
}

.ref-sidebar-btn.loom-invite-active {
  overflow: hidden;
  background: transparent;
  padding: 0;
  color: inherit;
}

/* Allow ToS card content to extend beyond button bounds */
.ref-sidebar-btn.loom-invite-active:has(.loom-invite-card--tos) {
  overflow: visible;
}

.loom-invite-stack--base {
  min-height: 100%;
  width: 100%;
}

.loom-invite-card--base {
  display: grid;
  gap: 22px;
  justify-items: center;
  padding: clamp(24px, 4.5vw, 36px);
  text-align: center;
}

.loom-invite-card__content {
  display: grid;
  gap: 10px;
  align-items: center;
  width: 100%;
}

.loom-invite-card__headline {
  font-size: clamp(16px, 3.8vw, 20px);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.94);
  text-shadow: 0 0 18px rgba(143, 180, 255, 0.45);
}

.loom-invite-card__subline {
  font-size: clamp(12px, 3vw, 14px);
  letter-spacing: 0.04em;
  color: rgba(213, 224, 255, 0.78);
}

.loom-invite-stack--base .loom-invite-emblem {
  margin-inline: auto;
  gap: 6px;
}

.loom-invite-stack {
  position: relative;
  display: grid;
  place-items: stretch;
  isolation: isolate;
  z-index: 10;
  overflow: visible;
  border-radius: 24px;
}

/* Only hide overflow for base invite (non-ToS) */
.loom-invite-stack--base {
  overflow: hidden;
}

.loom-invite-stack::before,
.loom-invite-stack::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(143, 180, 255, 0.18), rgba(102, 126, 234, 0.12));
  box-shadow: 0 30px 48px rgba(9, 12, 34, 0.45);
  pointer-events: none;
  transition: transform 0.4s ease, opacity 0.4s ease;
  z-index: -2;
}

.loom-invite-stack::before {
  transform: translateY(18px) scale(0.94);
  opacity: 0.42;
}

.loom-invite-stack::after {
  transform: translateY(9px) scale(0.97);
  opacity: 0.58;
  z-index: -1;
}

.loom-invite-card {
  position: relative;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.24), rgba(143, 180, 255, 0.16));
  box-shadow: 0 24px 45px rgba(9, 12, 34, 0.55), 0 0 0 1px rgba(143, 180, 255, 0.28);
  pointer-events: auto;
  transition: transform 0.35s ease, box-shadow 0.35s ease, filter 0.35s ease;
}

.celli-ref-overlay.ref-mode-mobile .ref-sidebar-btn.loom-invite-base {
  width: min(360px, 90vw);
  margin-inline: auto;
}

.celli-ref-overlay.ref-mode-mobile .loom-invite-stack {
  width: 100%;
}

.celli-ref-overlay.ref-mode-mobile .loom-invite-card,
.celli-ref-overlay.ref-mode-mobile .loom-invite-card--base {
  width: 100%;
  gap: clamp(16px, 6vw, 22px);
  padding: clamp(20px, 7vw, 28px);
  border-radius: clamp(18px, 8vw, 26px);
  box-shadow: 0 18px 38px rgba(9, 12, 34, 0.55), 0 0 0 1px rgba(143, 180, 255, 0.3);
}

.celli-ref-overlay.ref-mode-mobile .loom-invite-card__content {
  gap: clamp(8px, 3vw, 14px);
}

.celli-ref-overlay.ref-mode-mobile .loom-invite-card__headline {
  font-size: clamp(15px, 5vw, 19px);
}

.celli-ref-overlay.ref-mode-mobile .loom-invite-card__subline {
  font-size: clamp(12px, 4.4vw, 15px);
  line-height: 1.5;
}

.loom-invite-card--tos {
  width: min(90vw, 520px);
  max-width: 520px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 36px);
  display: grid;
  gap: clamp(20px, 5vw, 32px);
  color: #f8f9fa;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  min-height: clamp(340px, 60vh, 540px);
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.28), rgba(143, 180, 255, 0.18));
  position: relative;
  overflow: visible;
  border-radius: 24px;
  border: 1px solid rgba(160, 190, 255, 0.4);
  box-shadow: 0 24px 50px rgba(9, 12, 34, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(18px) saturate(220%);
  -webkit-backdrop-filter: blur(18px) saturate(220%);
}

.loom-invite-card--tos.tos-holding {
  box-shadow: 0 18px 44px rgba(9, 12, 34, 0.55);
  filter: saturate(1.05);
}

.loom-invite-card--tos.tos-locked {
  box-shadow: 0 22px 54px rgba(12, 16, 40, 0.62);
  border: 1px solid rgba(255, 79, 100, 0.3);
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.24), rgba(255, 79, 100, 0.12));
}

.loom-invite-card--tos.tos-morphing,
.loom-invite-card--tos.morphing {
  animation: tos-card-morph 1.05s ease forwards;
  background: linear-gradient(140deg, rgba(10, 12, 18, 0.96), rgba(5, 6, 12, 0.98));
  box-shadow: 0 28px 68px rgba(0, 0, 0, 0.65), inset 0 0 36px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.08);
  transform-origin: 50% 50%;
  will-change: transform, clip-path, filter;
}

.loom-invite-card--tos.tos-morphing .loom-invite-card__header,
.loom-invite-card--tos.tos-morphing .loom-invite-card__body {
  animation: tos-card-fade 0.6s ease forwards;
}

.loom-invite-card--tos.beta-card {
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
  border-radius: 16px;
  background: #050505;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 30px 74px rgba(0, 0, 0, 0.72);
}

.loom-invite-card--tos.triangle-flight {
  animation: tos-triangle-flight 1.6s cubic-bezier(0.19, 1, 0.32, 1) forwards;
}

.loom-invite-card--tos.into-frame {
  background: #050505;
  border: 2px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 68px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
  filter: drop-shadow(0 0 46px rgba(0, 0, 0, 0.72));
}

.loom-invite-card--tos.triangle-collapse-complete {
  opacity: 0;
  pointer-events: none;
}

@keyframes tos-card-fade {
  to {
    opacity: 0;
    filter: blur(12px);
  }
}

@keyframes tos-card-morph {
  0% {
    clip-path: inset(0%);
    border-radius: 24px;
    transform: translate3d(0, 0, 0) scale(1);
  }
  45% {
    clip-path: polygon(42% 0%, 100% 100%, 0% 100%);
    transform: translate3d(0, -8px, 0) scale(0.95);
  }
  100% {
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    transform: translate3d(0, -18px, 0) scale(0.88);
  }
}

@keyframes tos-triangle-flight {
  0% {
    transform: translate3d(0, 0, 0) scale(0.9) rotate(0deg);
    opacity: 1;
  }
  40% {
    transform: translate3d(-8%, -12%, 0) scale(0.86) rotate(-4deg);
  }
  70% {
    transform: translate3d(10%, -28%, 0) scale(0.78) rotate(5deg);
    opacity: 0.8;
  }
  100% {
    transform: translate3d(0, -48%, 0) scale(0.68) rotate(0deg);
    opacity: 0.4;
  }
}

.loom-invite-card__header {
  padding: clamp(24px, 4.2vw, 32px);
  display: flex;
  justify-content: center;
  align-items: center;
  background: linear-gradient(140deg, rgba(118, 75, 162, 0.28), rgba(102, 126, 234, 0.24), rgba(143, 180, 255, 0.22));
  border-bottom: 1px solid rgba(143, 180, 255, 0.28);
  backdrop-filter: blur(14px);
}

.loom-invite-card__body {
  display: grid;
  gap: clamp(18px, 4.2vw, 30px);
  font-size: clamp(14px, 3.8vw, 16px);
  line-height: 1.8;
  color: rgba(240, 245, 255, 0.94);
}

.loom-invite-opening {
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.6;
  color: #ffffff;
}

.loom-invite-body-text {
  opacity: 0.95;
  font-size: clamp(13px, 3.4vw, 15px);
}

.loom-invite-alpha {
  font-weight: 600;
  color: #8fb4ff;
  text-shadow: 0 0 8px rgba(143, 180, 255, 0.5);
}

.loom-invite-divider {
  margin-top: clamp(16px, 3vw, 28px);
  padding-top: clamp(18px, 3.4vw, 26px);
  border-top: 1px solid rgba(143, 180, 255, 0.2);
  font-size: clamp(12px, 3vw, 14px);
  opacity: 0.85;
  font-weight: 300;
  letter-spacing: 0.05em;
}

.tos-abbrev {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: rgba(143, 180, 255, 0.82);
  transition: color 0.4s ease, transform 0.45s ease;
  position: relative;
}

.tos-abbrev--eternal {
  color: rgba(255, 255, 255, 0.92);
  transform: scale(1.06) translateY(-1px);
}

.tos-abbrev-e {
  color: #ff4f64;
  font-weight: 700;
  text-shadow: 0 0 16px rgba(255, 79, 100, 0.55);
  position: relative;
  display: inline-block;
  transform: rotate(-8deg) scale(1.08);
  letter-spacing: -0.04em;
}

.tos-abbrev--eternal .tos-abbrev-e::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 52%;
  width: 170%;
  height: 2px;
  background: linear-gradient(90deg, rgba(255, 79, 100, 0.85), rgba(255, 79, 100, 0));
  transform: translate(-50%, -50%) rotate(-10deg);
  opacity: 0.8;
  pointer-events: none;
}

@keyframes tos-frame-shake {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
  25% { transform: translate3d(2px, -2px, 0) rotate(-0.25deg); }
  50% { transform: translate3d(-2px, 2px, 0) rotate(0.3deg); }
  75% { transform: translate3d(1px, 3px, 0) rotate(-0.2deg); }
}

.celli-ref-overlay.tos-hold-shaking #refSidebarAck,
.celli-ref-overlay.tos-hold-shaking .loom-invite-stack {
  animation: tos-frame-shake 0.28s linear infinite;
}

.celli-ref-overlay.tos-ascension {
  pointer-events: none;
}

.celli-ref-overlay.tos-ascension #refSidebarAck {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(380px, 82vw);
}

.celli-ref-overlay.tos-ascension .loom-invite-stack {
  width: 100%;
  pointer-events: none;
}

.celli-ref-overlay.tos-ascension .ref-sidebar {
  opacity: 0;
}

.tos-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 18px;
  margin-top: clamp(6px, 2vw, 12px);
  padding: clamp(14px, 3.2vw, 18px) clamp(18px, 4vw, 24px);
  background: linear-gradient(135deg, rgba(143, 180, 255, 0.12), rgba(102, 126, 234, 0.16));
  border: 1px solid rgba(143, 180, 255, 0.35);
  border-radius: 14px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: clamp(10px, 2.6vw, 11px);
  color: #a0b0c0;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.tos-label:focus-visible {
  outline: 2px solid rgba(143, 180, 255, 0.6);
  outline-offset: 3px;
}

.tos-label:hover {
  box-shadow: 0 12px 28px rgba(12, 18, 45, 0.35);
  border-color: rgba(143, 180, 255, 0.5);
  transform: translateY(-2px);
}

.tos-label-text {
  flex: 1;
}

.tos-label-eternal {
  opacity: 0;
  transition: opacity 0.3s ease, color 0.3s ease;
}

.tos-label-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: clamp(22px, 5vw, 26px);
  height: clamp(22px, 5vw, 26px);
  border-radius: 50%;
  background: rgba(143, 180, 255, 0.16);
  box-shadow: inset 0 0 0 1px rgba(143, 180, 255, 0.2);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tos-label-arrow::before {
  content: '▾';
  font-size: clamp(12px, 3vw, 14px);
  color: rgba(160, 176, 208, 0.9);
  transition: transform 0.3s ease;
}

.tos-label.is-expanded .tos-label-arrow::before,
.tos-label[aria-expanded="true"] .tos-label-arrow::before {
  transform: rotate(180deg);
}

.tos-label.is-expanded .tos-label-arrow,
.tos-label[aria-expanded="true"] .tos-label-arrow {
  box-shadow: inset 0 0 0 1px rgba(143, 180, 255, 0.35);
}

.tos-expandable {
  margin-top: clamp(6px, 2vw, 12px);
  padding: clamp(12px, 3.2vw, 18px) clamp(16px, 3.8vw, 22px);
  border-left: 2px solid rgba(143, 180, 255, 0.25);
  background: linear-gradient(135deg, rgba(15, 25, 45, 0.45), rgba(25, 35, 55, 0.35));
  border-radius: 12px;
  color: rgba(223, 232, 255, 0.85);
  font-size: clamp(12px, 3.2vw, 13px);
  line-height: 1.6;
}

.tos-expandable-line {
  margin: 0;
}

.tos-checkbox {
  margin-top: clamp(12px, 3.2vw, 20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  cursor: pointer;
  padding: clamp(16px, 3.6vw, 22px) clamp(18px, 4.2vw, 26px);
  border: 1px solid rgba(143, 180, 255, 0.4);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(143, 180, 255, 0.12), rgba(102, 126, 234, 0.15));
  backdrop-filter: blur(15px) saturate(180%);
  box-shadow: 0 4px 24px rgba(102, 126, 234, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.15), inset 0 -1px 10px rgba(102, 126, 234, 0.1);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.35s ease;
}

.tos-checkbox:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 32px rgba(12, 18, 45, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.tos-checkbox.magnet-self-clickable {
  box-shadow: 0 0 42px rgba(143, 180, 255, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.18), inset 0 -1px 14px rgba(102, 126, 234, 0.18);
  border-color: rgba(143, 180, 255, 0.58);
}

.tos-checkbox.tos-hold-start {
  transform: scale(1.05);
  box-shadow: 0 0 48px rgba(143, 180, 255, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.2), inset 0 -1px 18px rgba(102, 126, 234, 0.22);
  border-color: rgba(143, 180, 255, 0.65);
}

.tos-checkbox.tos-hold-complete {
  transform: scale(1.08);
  background: linear-gradient(135deg, rgba(255, 79, 100, 0.18), rgba(102, 126, 234, 0.18));
  border-color: rgba(255, 79, 100, 0.55);
  box-shadow: 0 0 62px rgba(255, 79, 100, 0.52), inset 0 1px 0 rgba(255, 188, 202, 0.25), inset 0 -1px 20px rgba(255, 79, 100, 0.35);
}

.tos-checkbox.tos-hold-complete label {
  color: #ffe6eb;
  text-shadow: 0 0 12px rgba(255, 79, 100, 0.35);
}

.tos-checkbox.tos-hold-complete input {
  accent-color: #ff4f64;
}

.tos-checkbox input {
  width: 22px;
  height: 22px;
  cursor: pointer;
  accent-color: #667eea;
  border-radius: 4px;
  margin: 0;
}

.tos-checkbox label {
  cursor: pointer;
  user-select: none;
  font-size: clamp(12px, 3vw, 14px);
  font-weight: 400;
  color: #e8ecf0;
  letter-spacing: 0.04em;
  text-align: center;
}

.tos-checkbox:focus-within {
  outline: 2px solid rgba(143, 180, 255, 0.5);
  outline-offset: 3px;
}

@media (max-width: 600px) {
  .celli-ref-overlay.ref-mode-mobile .loom-invite-card--tos {
    width: min(100%, 360px);
    padding: clamp(20px, 6vw, 28px);
    gap: clamp(18px, 6vw, 26px);
    min-height: clamp(360px, 68vh, 560px);
  }

  .celli-ref-overlay.ref-mode-mobile .loom-invite-card__body {
    font-size: clamp(13px, 4vw, 15px);
  }

  .celli-ref-overlay.ref-mode-mobile .tos-label {
    letter-spacing: 0.14em;
  }

  .celli-ref-overlay.ref-mode-mobile .badboolean-ambient {
    inset: -12%;
  }

  .celli-ref-overlay.ref-mode-mobile .badboolean-ambient__char {
    font-size: clamp(10px, 4vw, 16px);
  }

  .celli-ref-overlay.ref-mode-mobile .badboolean-wave-char {
    transform: translateY(calc(var(--wave-level) * -8px)) scaleY(calc(1 + var(--wave-level) * 0.3));
    text-shadow: 0 0 calc(12px * var(--wave-level) + 1px) rgba(255, 255, 255, 0.6);
  }
}

.ref-sidebar-btn.loom-invite-active .loom-invite-card {
  transform: translateY(0);
}

.ref-sidebar-btn.loom-invite-active.audio-reactive .loom-invite-card {
  transform: translateY(calc(var(--chant-reactive, 0) * -4px)) scale(calc(1 + var(--chant-reactive, 0) * 0.05));
  box-shadow: 0 28px 60px rgba(12, 18, 45, calc(0.45 + var(--chant-reactive, 0) * 0.4)),
    0 0 0 1px rgba(143, 180, 255, calc(0.28 + var(--chant-reactive, 0) * 0.3));
  filter: saturate(calc(1 + var(--chant-reactive, 0) * 0.35));
}

.ref-sidebar-btn.loom-invite-active.audio-reactive .loom-invite-stack::before {
  transform: translateY(calc(18px + var(--chant-reactive, 0) * 6px)) scale(calc(0.94 + var(--chant-reactive, 0) * 0.025));
  opacity: calc(0.42 + var(--chant-reactive, 0) * 0.2);
}

.ref-sidebar-btn.loom-invite-active.audio-reactive .loom-invite-stack::after {
  transform: translateY(calc(9px + var(--chant-reactive, 0) * 4px)) scale(calc(0.97 + var(--chant-reactive, 0) * 0.02));
  opacity: calc(0.58 + var(--chant-reactive, 0) * 0.18);
}

.ref-sidebar-btn:hover {
  transform: scale(1.05);
}

.ref-sidebar-btn.magnetic {
  transition: transform .1s, box-shadow .1s;
}

.ref-sidebar-btn.ai-scan-active::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg,
    rgba(143, 180, 255, 0) 0%,
    rgba(143, 180, 255, 0.28) 45%,
    rgba(255, 255, 255, 0.75) 50%,
    rgba(143, 180, 255, 0.28) 55%,
    rgba(143, 180, 255, 0) 100%);
  mix-blend-mode: screen;
  pointer-events: none;
  opacity: 0.85;
  animation: ai-scan-sweep 2.6s ease-in-out infinite;
  overflow: hidden;
  border-radius: inherit;
}

.ref-sidebar-btn.ai-scan-active::after {
  content: '';
  position: absolute;
  inset: 4%;
  border: 1px solid rgba(143, 180, 255, 0.25);
  border-radius: inherit;
  pointer-events: none;
  opacity: 0.35;
  animation: ai-scan-glow 3s ease-in-out infinite;
}

@keyframes ai-scan-sweep {
  0% {
    transform: translateX(-120%) skewX(-12deg);
  }
  45% {
    transform: translateX(10%) skewX(-12deg);
  }
  100% {
    transform: translateX(120%) skewX(-12deg);
  }
}

@keyframes ai-scan-glow {
  0%, 100% {
    opacity: 0.25;
  }
  40% {
    opacity: 0.6;
  }
  60% {
    opacity: 0.4;
  }
}

.ref-sidebar-url {
  background: rgba(0, 0, 0, .15);
  padding: 8px;
  border-radius: 6px;
  margin: 8px 0;
  font-size: 11px;
  word-break: break-all;
  font-family: monospace;
  opacity: .8;
  max-height: 60px;
  overflow: auto;
}

/* === Custom Cursor for Magnetic Effect === */
@keyframes bounceIn {
  0% {
    transform: translateY(-50%) scale(0.3);
    opacity: 0;
  }
  50% {
    transform: translateY(-50%) scale(1.05);
    opacity: 1;
  }
  70% {
    transform: translateY(-50%) scale(0.9);
  }
  100% {
    transform: translateY(-50%) scale(1);
  }
}

.ref-sidebar.bouncing {
  animation: bounceIn .6s cubic-bezier(.68, -.55, .265, 1.55);
}

.ref-sidebar.impact {
  animation: sidebarImpact .8s cubic-bezier(.68, -.55, .265, 1.55);
}

@keyframes sidebarImpact {
  0% {
    transform: translateY(-50%) scale(1);
    box-shadow: -8px 0 40px rgba(0, 0, 0, .4);
  }
  30% {
    transform: translateY(-50%) scale(1.05) translateX(-10px);
    box-shadow: -20px 0 60px rgba(102, 126, 234, 0.8), 0 0 40px rgba(118, 75, 162, 0.6);
  }
  50% {
    transform: translateY(-50%) scale(1.08) translateX(5px);
    box-shadow: -30px 0 80px rgba(102, 126, 234, 1), 0 0 60px rgba(118, 75, 162, 0.8);
  }
  70% {
    transform: translateY(-50%) scale(1.03) translateX(-3px);
    box-shadow: -20px 0 60px rgba(102, 126, 234, 0.6), 0 0 40px rgba(118, 75, 162, 0.4);
  }
  100% {
    transform: translateY(-50%) scale(1);
    box-shadow: -8px 0 40px rgba(0, 0, 0, .4);
  }
}

/* Edge Impact Effects - Flicker and Burst */
.edge-impact {
  position: fixed;
  right: calc(var(--ref-edge-offset, 80px) * -0.6); /* Extend beyond edge to prevent clipping */
  top: -50px;
  bottom: -50px;
  width: var(--ref-edge-impact-width, 500px); /* Wider to ensure gradient isn't clipped */
  pointer-events: none;
  z-index: 2147483500;
  opacity: 0;
}

.edge-impact.active {
  animation: edgeFlickerBurst 1.2s ease-out forwards;
}

@keyframes edgeFlickerBurst {
  0% {
    background: transparent;
    opacity: 0;
  }
  /* Initial flicker sequence */
  5% {
    background: linear-gradient(to left, rgba(255, 255, 255, 0.9), transparent);
    opacity: 1;
  }
  8% {
    background: transparent;
    opacity: 0;
  }
  11% {
    background: linear-gradient(to left, rgba(255, 255, 255, 0.7), transparent);
    opacity: 1;
  }
  14% {
    background: transparent;
    opacity: 0;
  }
  17% {
    background: linear-gradient(to left, rgba(255, 255, 255, 1), transparent);
    opacity: 1;
  }
  20% {
    background: transparent;
    opacity: 0;
  }
  23% {
    background: linear-gradient(to left, rgba(255, 255, 255, 0.6), transparent);
    opacity: 1;
  }
  /* Main light burst */
  30% {
    background: radial-gradient(ellipse at right center, rgba(255, 255, 255, 1), rgba(102, 126, 234, 0.6), transparent);
    opacity: 1;
  }
  45% {
    background: radial-gradient(ellipse at right center, rgba(255, 255, 255, 0.8), rgba(118, 75, 162, 0.4), transparent);
    opacity: 1;
  }
  /* Dimming flicker */
  55% {
    background: linear-gradient(to left, rgba(0, 0, 0, 0.6), transparent);
    opacity: 1;
  }
  58% {
    background: transparent;
    opacity: 0.8;
  }
  61% {
    background: linear-gradient(to left, rgba(0, 0, 0, 0.7), transparent);
    opacity: 1;
  }
  64% {
    background: transparent;
    opacity: 0.6;
  }
  67% {
    background: linear-gradient(to left, rgba(0, 0, 0, 0.8), transparent);
    opacity: 1;
  }
  100% {
    background: transparent;
    opacity: 0;
  }
}

/* Progressive Darkening Overlay */
.darkening-overlay {
  position: fixed;
  right: calc(var(--ref-edge-offset, 80px) * -1.2); /* Extend beyond edge */
  top: -50px;
  bottom: -50px;
  width: calc(var(--ref-edge-impact-width, 500px) + var(--ref-edge-offset, 80px) * 1.8);
  pointer-events: none;
  z-index: 2147483450;
  background: linear-gradient(to left, rgba(0, 0, 0, 0), transparent);
  opacity: 0;
  transition: opacity 0.5s ease-out, background 0.8s ease-out;
}

.darkening-overlay.level-1 {
  background: linear-gradient(to left, rgba(0, 0, 0, 0.15), transparent);
  opacity: 1;
}

.darkening-overlay.level-2 {
  background: linear-gradient(to left, rgba(0, 0, 0, 0.3), transparent);
  opacity: 1;
}

.darkening-overlay.level-3 {
  background: linear-gradient(to left, rgba(0, 0, 0, 0.5), transparent);
  opacity: 1;
}

.darkening-overlay.level-4 {
  background: linear-gradient(to left, rgba(0, 0, 0, 0.7), transparent);
  opacity: 1;
}

.darkening-overlay.level-5 {
  background: linear-gradient(to left, rgba(0, 0, 0, 0.85), transparent);
  opacity: 1;
}

.base-darkness {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2147483380;
  background: radial-gradient(circle at center, rgba(8, 10, 18, 0.05) 0%, rgba(3, 5, 12, 0.85) 100%);
  opacity: 0;
  transition: opacity 0.9s ease, filter 1s ease;
  filter: saturate(1);
}

.base-darkness.level-1 { opacity: 0.18; }
.base-darkness.level-2 { opacity: 0.32; }
.base-darkness.level-3 { opacity: 0.48; }
.base-darkness.level-4 { opacity: 0.65; }
.base-darkness.level-5 { opacity: 0.78; filter: saturate(1.1); }

/* Light Beam from Center */
.light-beam {
  position: fixed;
  right: 0;
  top: var(--ref-light-beam-center-y, 50vh);
  transform: translateY(-50%);
  width: var(--ref-light-beam-target-width, var(--ref-light-beam-width, 900px));
  height: var(--ref-light-beam-target-height, var(--ref-light-beam-height, 400px));
  pointer-events: none;
  z-index: 2147483550;
  opacity: 0;
  background: radial-gradient(ellipse 50% 50% at 100% 50%,
    rgba(255, 255, 255, 0.9),
    rgba(255, 255, 255, 0.6) 30%,
    rgba(102, 126, 234, 0.4) 50%,
    rgba(118, 75, 162, 0.2) 70%,
    transparent);
  filter: blur(var(--ref-light-beam-blur, 15px));
  transition: opacity 0.4s ease, transform 0.45s ease, filter 0.6s ease;
}

.light-beam.active {
  animation: beamPulse 3s ease-in-out infinite;
}

.light-beam.audio-reactive {
  animation: none;
  opacity: calc(0.35 + var(--chant-reactive, 0) * 0.65);
  transform: translateY(-50%) scaleX(calc(1 + var(--chant-reactive, 0) * 0.45)) scaleY(calc(1 + var(--chant-reactive, 0) * 0.08));
  filter: blur(calc(var(--ref-light-beam-blur, 15px) * (1 + var(--chant-reactive, 0) * 0.18)));
}

#videoPlayerOverlay[data-active="inline"] {
  align-items: flex-start;
  padding-top: clamp(32px, 10vh, 80px);
}

#videoPlayerOverlay .beta-form-inline {
  border: 0;
  width: min(940px, 92vw);
  height: min(620px, 82vh);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  background: #000;
  transition: box-shadow 0.4s ease;
}

#videoPlayerOverlay .beta-form-inline:hover,
#videoPlayerOverlay .beta-form-inline:focus {
  box-shadow: 0 28px 72px rgba(0, 0, 0, 0.6);
}

@keyframes beamPulse {
  0% {
    opacity: 0.6;
    transform: translateY(-50%) scaleX(1);
  }
  50% {
    opacity: 0.9;
    transform: translateY(-50%) scaleX(1.2);
  }
  100% {
    opacity: 0.6;
    transform: translateY(-50%) scaleX(1);
  }
}

/* Particle Effects */
.impact-particle {
  position: fixed;
  width: 5px;
  height: 5px;
  pointer-events: none;
  z-index: 2147483700 !important;
  opacity: 0;
  mix-blend-mode: screen;
  filter: brightness(calc(0.65 + var(--chant-reactive, 0) * 0.9));
  transition: filter 0.25s ease;
}

.impact-particle--circle {
  border-radius: 50%;
}

.impact-particle--square {
  border-radius: 4px;
}

.impact-particle--triangle {
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  transform-origin: center;
}

.ref-note-centered .impact-particle {
  z-index: 2147483540;
}

.impact-particle.active {
  animation: particleExplode 0.6s ease-out forwards;
}

@keyframes particleExplode {
  0% {
    transform: rotate(var(--particle-rotation, 0deg)) translate(0, 0) scale(1.35);
    opacity: 1;
  }
  20% {
    transform: rotate(var(--particle-rotation, 0deg)) translate(calc(var(--particle-x) * 0.3), calc(var(--particle-y) * 0.3)) scale(1.12);
    opacity: 1;
  }
  60% {
    transform: rotate(var(--particle-rotation, 0deg)) translate(calc(var(--particle-x) * 0.8), calc(var(--particle-y) * 0.8)) scale(0.58);
    opacity: 0.6;
  }
  100% {
    transform: rotate(var(--particle-rotation, 0deg)) translate(var(--particle-x), var(--particle-y)) scale(0.12);
    opacity: 0;
  }
}

.ref-footer {
  display: none !important; /* Hidden per user request */
}

.ref-footer .ref-controls {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.ref-footer .ref-feedback-link {
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.ref-footer .btn {
  background: #191a23;
  border: 0;
  color: #ddd;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.ref-footer .btn:active {
  transform: translateY(1px);
}

/* === Glitch layers === */
.ref-glitch {
  pointer-events: none;
  position: absolute;
  inset: 0;
  z-index: 25;
}

.slice {
  position: absolute;
  left: 0;
  right: 0;
  height: 10%;
  overflow: hidden;
}

.row {
  transform: translateX(0);
  opacity: .12;
}

.glitch-r {
  filter: drop-shadow(-1px 0 0 rgba(255, 0, 0, .5));
}

.glitch-g {
  filter: drop-shadow(1px 0 0 rgba(0, 255, 128, .25));
}

.glitch-b {
  filter: drop-shadow(2px 0 0 rgba(0, 128, 255, .25));
}

.jitter {
  animation: jitter 100ms steps(2) infinite;
}

@keyframes jitter {
  0% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(1px, -1px);
  }
  100% {
    transform: translate(0, 0);
  }
}

/* === Golden Ascension Post-Terms Sequence === */
.golden-ascension-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483600;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 32px;
  padding: clamp(24px, 8vw, 72px);
  background: radial-gradient(circle at center, rgba(255, 220, 120, 0.35) 0%, rgba(61, 44, 0, 0.9) 55%, rgba(18, 12, 0, 0.96) 100%);
  color: #fff7d1;
  font-family: 'Roboto Mono', 'Segoe UI', system-ui, sans-serif;
  overflow: hidden;
  pointer-events: auto;
  transition: background 1.4s ease;
}

.golden-ascension-overlay.blackout-stage {
  transition: background 0.9s ease, color 0.9s ease;
}

.golden-ascension-overlay.blackout-stage.blackout-active {
  background: radial-gradient(circle at center, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.98) 58%, #000 100%);
  color: #f5f7ff;
}

.golden-ascension-overlay.blackout-stage::before,
.golden-ascension-overlay.blackout-stage::after {
  opacity: 0;
}

.golden-ascension-overlay::before {
  content: '';
  position: absolute;
  inset: -60%;
  background: repeating-linear-gradient(135deg, rgba(255, 232, 166, 0.05) 0px, rgba(255, 232, 166, 0.18) 6px, transparent 12px);
  mix-blend-mode: screen;
  animation: golden-sweep 4s linear infinite;
  opacity: 0.6;
}

.golden-ascension-overlay::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 30%, rgba(255, 245, 197, 0.4) 0%, rgba(255, 220, 141, 0.3) 40%, rgba(22, 12, 0, 0.6) 100%);
  pointer-events: none;
  opacity: 0.85;
}

.golden-ascension-overlay .golden-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  text-align: center;
  width: min(520px, 92vw);
  padding: clamp(12px, 3vw, 24px);
}

.golden-instruction {
  font-size: clamp(12px, 2.6vw, 14px);
  letter-spacing: clamp(0.14em, 2.6vw, 0.18em);
  text-transform: uppercase;
  color: rgba(255, 240, 178, 0.9);
  text-shadow: 0 0 18px rgba(255, 215, 0, 0.6);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.golden-hold-wrapper {
  position: relative;
  width: min(460px, 92vw);
  display: flex;
  justify-content: center;
  padding: clamp(10px, 3vw, 18px);
}

.golden-hold-button {
  position: relative;
  width: min(360px, 80vw);
  height: clamp(104px, 30vw, 150px);
  border-radius: clamp(26px, 14vw, 42px);
  background: linear-gradient(135deg, rgba(22, 24, 32, 0.96) 0%, rgba(5, 6, 12, 0.98) 52%, rgba(0, 0, 0, 1) 100%);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.62), inset 0 1px 14px rgba(255, 255, 255, 0.06);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  padding: clamp(12px, 3vw, 24px);
  transition: transform 0.45s cubic-bezier(0.23, 1, 0.32, 1), clip-path 0.85s cubic-bezier(0.77, 0, 0.175, 1), border-radius 0.6s ease, width 0.6s ease, height 0.6s ease, background 0.6s ease, box-shadow 0.6s ease, opacity 0.35s ease, filter 0.6s ease;
  transform: translate3d(var(--cursor-dx, 0), var(--cursor-dy, 0), 0) scale(var(--cursor-scale, 1));
  clip-path: inset(0% round clamp(26px, 14vw, 42px));
  cursor: pointer;
  filter: drop-shadow(0 0 38px rgba(8, 10, 20, 0.78));
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.golden-hold-button.primed,
.golden-hold-button.holding {
  background: linear-gradient(125deg, rgba(4, 5, 8, 1) 0%, rgba(0, 0, 0, 0.98) 100%);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.78), inset 0 0 28px rgba(0, 0, 0, 0.6);
  filter: drop-shadow(0 0 48px rgba(12, 14, 22, 0.92));
}

.golden-hold-button.charged {
  filter: drop-shadow(0 0 62px rgba(28, 42, 98, 0.55));
}

.golden-hold-button .golden-invite-shell {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  transition: filter 0.45s ease, opacity 0.45s ease, transform 0.45s ease;
}

.golden-hold-button .golden-invite-stack {
  transform: scale(0.94);
  filter: drop-shadow(0 16px 36px rgba(32, 46, 84, 0.4));
  transition: filter 0.45s ease, transform 0.45s ease, opacity 0.45s ease;
}

.golden-hold-button.charging .golden-invite-stack {
  filter: drop-shadow(0 20px 40px rgba(102, 166, 255, 0.45));
  transform: scale(0.96) rotate(-0.8deg);
}

.golden-hold-button.primed .golden-invite-shell {
  opacity: 0.35;
  filter: saturate(0.7) brightness(0.85);
  transform: scale(0.96);
}

.golden-hold-button.charged .golden-invite-shell {
  opacity: 0.18;
  transform: scale(0.94);
}

.golden-hold-button.dimension-locked {
  width: var(--locked-width, min(360px, 80vw));
  height: var(--locked-height, clamp(104px, 30vw, 150px));
  transition: transform 0.45s cubic-bezier(0.23, 1, 0.32, 1), clip-path 0.85s cubic-bezier(0.77, 0, 0.175, 1), border-radius 0.6s ease, background 0.6s ease, box-shadow 0.6s ease, opacity 0.35s ease, filter 0.45s ease;
}

.golden-hold-button:hover:not(.snapping-to-cursor):not(.cursor-synced) {
  transform: translate3d(var(--cursor-dx, 0), calc(var(--cursor-dy, 0) - 6px), 0) scale(1.03);
}

.golden-hold-button.snapping-to-cursor {
  pointer-events: none;
}

.golden-hold-button.cursor-synced {
  opacity: 0;
}

.golden-hold-button.morphing {
  opacity: 1;
}

.golden-hold-button .golden-label {
  font-size: clamp(13px, 3.6vw, 16px);
  font-weight: 600;
  letter-spacing: 0.26em;
  color: rgba(168, 198, 255, 0.82);
  text-shadow: 0 0 12px rgba(142, 182, 255, 0.65);
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.golden-hold-button .golden-hold-energy {
  position: absolute;
  inset: -22%;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.82);
  background: radial-gradient(circle at center, rgba(120, 190, 255, 0.22) 0%, transparent 62%);
  mix-blend-mode: screen;
  transition: opacity 0.45s ease, transform 0.6s ease, filter 0.6s ease;
}

.golden-hold-button .golden-hold-energy::before,
.golden-hold-button .golden-hold-energy::after {
  content: '';
  position: absolute;
  inset: 12% 6%;
  border-radius: 58%;
  border: 2px solid rgba(122, 180, 255, 0.28);
  opacity: 0.5;
  mix-blend-mode: screen;
  animation: holdEnergySpin 2.8s linear infinite;
}

.golden-hold-button .golden-hold-energy::after {
  inset: 6% 12%;
  border-color: rgba(90, 160, 255, 0.18);
  animation-direction: reverse;
  animation-duration: 3.2s;
}

.golden-hold-button.charging .golden-hold-energy {
  opacity: 1;
  transform: scale(1);
}

.golden-hold-button.charged .golden-hold-energy {
  opacity: 1;
  transform: scale(1.08);
  filter: blur(1.5px);
}

.golden-trail-pack {
  position: absolute;
  right: 100%;
  top: 50%;
  width: 240px;
  height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transform: translate(-30px, -50%);
  pointer-events: none;
  opacity: 0;
}

.golden-trail-pack span {
  display: block;
  width: 0;
  height: 2px;
  background: linear-gradient(to left, rgba(36, 40, 70, 0), rgba(108, 168, 255, 0.82));
}

.golden-hold-button.charging .golden-trail-pack span {
  animation: trailCharge 1.2s ease-in-out infinite;
  animation-delay: calc(var(--i, 0) * 45ms);
}

.golden-ascension-overlay.holding .golden-hold-button {
  animation: golden-shake 0.28s linear infinite;
}

.golden-ascension-overlay.holding .golden-instruction {
  opacity: 0.65;
}

.golden-hold-button.charging .golden-label {
  color: rgba(178, 210, 255, 0.9);
  letter-spacing: 0.32em;
  text-shadow: 0 0 16px rgba(144, 188, 255, 0.7);
}

.golden-hold-button.charged .golden-label {
  opacity: 0;
}

.golden-hold-button.morphing {
  animation: organic-triangle 1.05s ease forwards;
  background: linear-gradient(140deg, #050505 0%, #090909 45%, #000 100%);
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.65), inset 0 0 36px rgba(0, 0, 0, 0.45);
  filter: drop-shadow(0 0 42px rgba(0, 0, 0, 0.7));
}

.golden-hold-button.morphing .golden-label {
  opacity: 0;
}

.golden-ascension-overlay.hold-complete .golden-instruction {
  opacity: 0;
  transform: translateY(-16px);
}

.golden-ascension-overlay.hold-complete .golden-content {
  pointer-events: none;
}

.golden-ascension-overlay.hold-complete .golden-hold-wrapper {
  position: absolute;
  inset: 0;
}

.golden-ascension-overlay.hold-complete .golden-hold-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transform-origin: 50% 50%;
  width: var(--locked-width, 220px);
  height: var(--locked-height, 180px);
}

.golden-hold-button.beta-card {
  clip-path: inset(0% round 12px);
  border-radius: 12px;
  background: #050505;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.72);
}

.golden-hold-button.triangle-flight {
  animation: triangle-flight 1.6s cubic-bezier(0.19, 1, 0.32, 1) forwards;
}

.golden-hold-button.into-frame {
  background: #050505;
  border: 2px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 68px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
  filter: drop-shadow(0 0 46px rgba(0, 0, 0, 0.72));
}

.golden-hold-button.into-frame .golden-trail-pack {
  opacity: 0;
}

.golden-hold-button.into-frame .golden-trail-pack span {
  animation: none;
  background: linear-gradient(to left, rgba(5, 5, 5, 0), rgba(5, 5, 5, 0.65));
}

.golden-hold-button.triangle-flight .golden-trail-pack {
  opacity: 0;
}

.golden-hold-button.triangle-flight .golden-trail-pack span {
  animation: none;
}

.golden-hold-button.triangle-collapse-complete {
  opacity: 0;
  pointer-events: none;
}

.frame-burst {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.12);
  opacity: 0;
  transform: scale(1.05);
  transition: opacity 0.6s ease, transform 1.1s cubic-bezier(0.19, 1, 0.22, 1);
  mix-blend-mode: normal;
  pointer-events: none;
  box-shadow: 0 36px 90px rgba(0, 0, 0, 0.7), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
  background: radial-gradient(circle at center, rgba(12, 12, 12, 0.65), transparent 70%);
}

.frame-burst.active {
  opacity: 1;
  transform: scale(1.14);
  box-shadow: 0 40px 110px rgba(0, 0, 0, 0.75), inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.beta-form-portal {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(520px, 90vw);
  aspect-ratio: 520 / 620;
  border: 2px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.06);
  transform: translate(-50%, -50%) scale(0.08);
  opacity: 0;
  transition: transform 1.4s cubic-bezier(0.19, 1, 0.22, 1), opacity 1s ease;
  pointer-events: none;
  overflow: hidden;
  background: linear-gradient(160deg, rgba(6, 6, 6, 0.92), rgba(20, 20, 20, 0.78));
}

.beta-form-portal.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  box-shadow: 0 34px 92px rgba(0, 0, 0, 0.82), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.beta-form-portal__glow {
  position: absolute;
  inset: -120%;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.03) 45%, transparent 70%);
  mix-blend-mode: screen;
  animation: portal-glow 2.4s ease-in-out infinite;
}

.golden-whiteout {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 50%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.6) 40%, rgba(255, 255, 255, 0) 65%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.4s ease;
}

.golden-ascension-overlay.dust-phase {
  background: radial-gradient(circle at 70% 50%, rgba(255, 253, 245, 0.88) 0%, rgba(250, 246, 234, 0.85) 35%, rgba(255, 255, 255, 1) 70%);
  color: #1b1200;
}

.golden-ascension-overlay.dust-phase::after {
  opacity: 0.2;
}

.golden-ascension-overlay.dust-phase::before {
  opacity: 0.2;
}

.golden-ascension-overlay.dust-phase .golden-whiteout {
  opacity: 0.1;
}

.golden-ascension-overlay.dust-complete .golden-whiteout {
  opacity: 1;
}

.golden-ascension-overlay.dust-complete .golden-trail-pack {
  opacity: 0;
}

.golden-ascension-overlay.dust-complete .golden-trail-pack span {
  animation: none;
}

.golden-dust-canvas {
  position: absolute;
  inset: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  mix-blend-mode: screen;
}

.golden-dust-canvas.fade-out {
  transition: opacity 1s ease;
  opacity: 0;
}

body.referrer-mobile .golden-ascension-overlay {
  gap: clamp(20px, 7vw, 26px);
  padding: clamp(20px, 7vw, 36px);
  align-items: center;
}

body.referrer-mobile .golden-ascension-overlay .golden-content {
  width: min(100%, 360px);
  gap: clamp(18px, 6vw, 26px);
}

body.referrer-mobile .golden-instruction {
  font-size: clamp(11px, 4vw, 13px);
}

body.referrer-mobile .golden-hold-wrapper {
  width: 100%;
  padding: clamp(10px, 5vw, 18px);
}

body.referrer-mobile .golden-hold-button {
  width: min(100%, 320px);
  height: clamp(96px, 40vw, 140px);
  clip-path: inset(0% round clamp(24px, 14vw, 36px));
}

body.referrer-mobile .golden-hold-button .golden-label {
  font-size: clamp(12px, 4.2vw, 14px);
  letter-spacing: clamp(0.16em, 4.4vw, 0.22em);
}

body.referrer-mobile .beta-form-portal {
  width: min(340px, 88vw);
  aspect-ratio: 5 / 7;
  border-width: 3px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), 16px 16px 0 rgba(255, 255, 255, 0.08);
}

.warp-tunnel {
  position: absolute;
  inset: -20%;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.3) 30%, rgba(0, 0, 0, 0.05) 45%, rgba(0, 0, 0, 0.8) 100%);
  opacity: 0;
  transform: scale(0.5);
  filter: blur(2px);
  pointer-events: none;
}

.warp-tunnel.active {
  animation: warp-tunnel-expand 2.6s ease-out forwards;
}

.warp-stars {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.18) 45%, rgba(0, 0, 0, 0.55) 100%);
  mix-blend-mode: multiply;
  opacity: 0;
}

.warp-stars::before,
.warp-stars::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(0, 0, 0, 0.85) 0 2px, transparent 2px);
  background-size: 4px 4px;
  opacity: 0.35;
  animation: warp-stars-pulse 0.45s linear infinite;
}

.warp-stars::after {
  background-size: 6px 6px;
  opacity: 0.25;
  animation-duration: 0.65s;
}

.warp-stars.active {
  opacity: 1;
}

.warp-depth-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transform: perspective(900px) rotateX(68deg);
  transform-origin: 50% 100%;
  opacity: 0;
}

.warp-depth-lines span {
  position: absolute;
  left: 50%;
  width: 1px;
  height: 0;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
  transform: translateX(calc((var(--depth-index, 0) - 3) * 18px));
  opacity: 0;
}

.warp-depth-lines.active {
  animation: warp-floor-rise 2.2s ease-out forwards;
}

.warp-depth-lines.active span {
  animation: warp-depth-line-grow 1.9s ease-out forwards;
  animation-delay: calc(var(--depth-index, 0) * 0.08s);
}

body.referrer-whiteout {
  transition: background 1.2s ease;
  background: #ffffff !important;
}

@keyframes golden-sweep {
  0% {
    transform: translate3d(-10%, -10%, 0) rotate(0deg);
  }
  100% {
    transform: translate3d(10%, 10%, 0) rotate(360deg);
  }
}

@keyframes golden-shake {
  0%, 100% {
    transform: translate(-50%, -50%) rotate(0deg) scale(1);
  }
  25% {
    transform: translate(calc(-50% - 4px), calc(-50% - 2px)) rotate(-1.3deg) scale(1.02);
  }
  50% {
    transform: translate(calc(-50% + 5px), calc(-50% + 3px)) rotate(1.2deg) scale(1.01);
  }
  75% {
    transform: translate(calc(-50% - 3px), calc(-50% + 4px)) rotate(-0.8deg) scale(1.03);
  }
}

@keyframes organic-triangle {
  0% {
    clip-path: inset(0% round 36px);
    border-radius: 36px;
    transform: translate3d(0, 0, 0) scale(1);
  }
  35% {
    clip-path: polygon(52% 10%, 12% 94%, 92% 94%);
    border-radius: 20px;
    transform: translate3d(0, -6px, 0) scale(0.98);
  }
  65% {
    clip-path: polygon(50% 6%, 8% 96%, 92% 96%);
    border-radius: 12px;
    transform: translate3d(0, -10px, 0) scale(0.96);
  }
  100% {
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    border-radius: 6px;
    transform: translate3d(0, -14px, 0) scale(0.94);
  }
}

@keyframes holdEnergySpin {
  0% {
    transform: rotate(0deg) scale(0.94);
    opacity: 0.4;
  }
  50% {
    transform: rotate(180deg) scale(1.08);
    opacity: 0.75;
  }
  100% {
    transform: rotate(360deg) scale(0.94);
    opacity: 0.4;
  }
}

@keyframes trailCharge {
  0% {
    width: 0;
    opacity: 0.1;
  }
  40% {
    width: 140px;
    opacity: 0.55;
  }
  100% {
    width: 220px;
    opacity: 0;
  }
}

@keyframes sideways-trail {
  0% {
    width: 0;
    opacity: 0;
  }
  60% {
    width: 100%;
    opacity: 1;
  }
  100% {
    width: 100%;
    opacity: 0.4;
  }
}

@keyframes triangle-flight {
  0% {
    transform: perspective(900px) translate3d(-50%, -50%, 0) rotateX(0deg) scale(1);
    opacity: 1;
    filter: drop-shadow(0 24px 48px rgba(0, 0, 0, 0.6));
  }
  45% {
    transform: perspective(900px) translate3d(-50%, -58%, 0) rotateX(12deg) scale(0.55);
    opacity: 0.92;
    filter: drop-shadow(0 18px 56px rgba(0, 0, 0, 0.55));
  }
  80% {
    transform: perspective(900px) translate3d(-50%, -64%, 0) rotateX(22deg) scale(0.2);
    opacity: 0.56;
    filter: drop-shadow(0 14px 60px rgba(0, 0, 0, 0.45));
  }
  100% {
    transform: perspective(900px) translate3d(-50%, -68%, 0) rotateX(32deg) scale(0.05);
    opacity: 0.18;
    filter: drop-shadow(0 12px 60px rgba(0, 0, 0, 0.38));
  }
}

@keyframes warp-reorient {
  0% {
    clip-path: polygon(50% 6%, 10% 96%, 90% 96%);
    transform: translate(-50%, -52%) scale(1.1) rotateX(6deg);
  }
  50% {
    clip-path: polygon(50% 2%, 6% 92%, 94% 92%);
    transform: translate(-50%, -60%) scale(1.18) rotateY(14deg) rotateX(16deg);
  }
  100% {
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    transform: translate(-50%, -66%) scale(1.32) rotateY(24deg) rotateX(22deg);
  }
}

@keyframes warp-depth-line {
  0% {
    width: 0;
    opacity: 0;
  }
  40% {
    width: 100%;
    opacity: 1;
  }
  100% {
    width: 100%;
    opacity: 0.6;
  }
}

@keyframes warp-tunnel-expand {
  0% {
    opacity: 0;
    transform: scale(0.4);
  }
  40% {
    opacity: 0.7;
    transform: scale(1.05);
  }
  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}

@keyframes warp-stars-pulse {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-12px);
  }
}

@keyframes warp-floor-rise {
  0% {
    opacity: 0;
  }
  30% {
    opacity: 0.4;
  }
  100% {
    opacity: 1;
  }
}

@keyframes warp-depth-line-grow {
  0% {
    height: 0;
    opacity: 0;
  }
  40% {
    height: 60%;
    opacity: 1;
  }
  100% {
    height: 100%;
    opacity: 0.65;
  }
}

@keyframes portal-glow {
  0% {
    transform: scale(0.92);
    opacity: 0.28;
  }
  50% {
    transform: scale(1.06);
    opacity: 0.55;
  }
  100% {
    transform: scale(0.92);
    opacity: 0.28;
  }
}

.ref-loom-chat {
  position: fixed;
  bottom: clamp(16px, 4vw, 28px);
  right: clamp(16px, 4vw, 28px);
  width: min(320px, calc(100vw - 32px));
  background: rgba(12, 16, 32, 0.92);
  color: #f5f6ff;
  border-radius: 16px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.18);
  opacity: 0;
  transform: translate3d(0, 20px, 0);
  transition: opacity 0.4s ease, transform 0.4s ease;
  z-index: 2147483620;
  overflow: hidden;
  pointer-events: none;
  display: none;
}

.ref-loom-chat.visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.ref-loom-chat .loom-chat-header {
  background: rgba(255, 255, 255, 0.08);
  padding: 0.75rem 1rem;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ref-loom-chat .loom-chat-body {
  padding: 0.75rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  font-size: 0.85rem;
  line-height: 1.4;
}

.ref-loom-chat .loom-chat-message {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translate3d(0, 8px, 0);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.ref-loom-chat .loom-chat-message.visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.ref-loom-chat .loom-chat-sender {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: 0.25rem;
}

body.referrer-mobile .ref-loom-chat {
  left: 50%;
  right: auto;
  width: min(360px, calc(100vw - 32px));
  --ref-loom-chat-translate-x: -50%;
  transform: translate3d(var(--ref-loom-chat-translate-x, -50%), 20px, 0);
}

body.referrer-mobile .ref-loom-chat.visible {
  transform: translate3d(var(--ref-loom-chat-translate-x, -50%), 0, 0);
}

