html {
  -webkit-tap-highlight-color: rgba(88, 101, 242, 0.2);
}

body {
  position: relative;
  overflow-x: hidden;
}

/* When DevTools appear to be open, hide page content */
body.devtools-open > *:not(script) {
  visibility: hidden !important;
}

body.devtools-open::before {
  content: "Developer tools are disabled on this page.";
  visibility: visible;
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  padding: 2rem;
  text-align: center;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  background: var(--bg);
}

/* Animated mesh background */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: var(--bg);
  overflow: hidden;
}

.bg-mesh::before,
.bg-mesh::after {
  content: "";
  position: absolute;
  width: 140%;
  height: 140%;
  left: -20%;
  top: -20%;
  opacity: 0.5;
  animation: mesh-drift 22s ease-in-out infinite alternate;
}

.bg-mesh::before {
  background:
    radial-gradient(ellipse 50% 40% at 20% 30%, var(--hero-glow), transparent 55%),
    radial-gradient(ellipse 45% 35% at 80% 70%, rgba(155, 89, 182, 0.15), transparent 50%);
}

.bg-mesh::after {
  background: radial-gradient(ellipse 60% 50% at 60% 20%, rgba(67, 181, 129, 0.12), transparent 55%);
  animation-duration: 28s;
  animation-direction: alternate-reverse;
}

[data-theme="dark"] .bg-mesh::before {
  opacity: 0.7;
}

.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  transition: transform 0.4s ease-out;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.45;
  animation: orb-float 14s ease-in-out infinite;
}

.orb-1 {
  width: 320px;
  height: 320px;
  background: #5865f2;
  top: 10%;
  left: 5%;
  animation-delay: 0s;
}

.orb-2 {
  width: 280px;
  height: 280px;
  background: #7289da;
  top: 50%;
  right: 0;
  animation-delay: -4s;
}

.orb-3 {
  width: 200px;
  height: 200px;
  background: #9b59b6;
  bottom: 15%;
  left: 35%;
  animation-delay: -8s;
  opacity: 0.3;
}

@keyframes mesh-drift {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  100% {
    transform: translate(3%, 2%) rotate(3deg);
  }
}

@keyframes orb-float {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(20px, -30px) scale(1.05);
  }
}

/* Glass surfaces */
.glass {
  background: color-mix(in srgb, var(--bg-elevated) 72%, transparent);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}

.site-header {
  background: color-mix(in srgb, var(--bg-elevated) 75%, transparent);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
}

.hero-card,
.card,
.price-card,
.cmd-item,
.commands-sidebar,
.terms-content,
.search-box input {
  background: color-mix(in srgb, var(--bg-elevated) 78%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Hero polish */
.hero-badge {
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  animation: badge-pulse 3s ease-in-out infinite;
}

.hero-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: blink 2s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 var(--accent-soft);
  }
  50% {
    box-shadow: 0 0 0 6px transparent;
  }
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.hero h1 span {
  background-size: 200% auto;
  animation: gradient-shift 6s linear infinite;
}

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

.logo-mark {
  animation: logo-glow 4s ease-in-out infinite;
}

@keyframes logo-glow {
  0%,
  100% {
    box-shadow: 0 4px 20px var(--hero-glow);
  }
  50% {
    box-shadow: 0 4px 32px var(--hero-glow), 0 0 40px var(--accent-soft);
  }
}

/* Buttons */
.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    105deg,
    transparent 40%,
    rgba(255, 255, 255, 0.2) 50%,
    transparent 60%
  );
  transform: translateX(-100%);
  transition: transform 0.6s;
}

.btn-primary:hover::after {
  transform: translateX(100%);
}

/* Cards hover */
.card {
  transition:
    transform 0.25s ease,
    border-color var(--transition),
    box-shadow 0.25s ease;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 40px var(--hero-glow);
}

.price-card.featured {
  background: linear-gradient(
      var(--bg-elevated),
      var(--bg-elevated)
    )
    padding-box,
    linear-gradient(135deg, #5865f2, #7289da, #9b59b6) border-box;
  border: 2px solid transparent;
  animation: border-glow 4s ease infinite;
}

@keyframes border-glow {
  0%,
  100% {
    filter: drop-shadow(0 0 12px var(--hero-glow));
  }
  50% {
    filter: drop-shadow(0 0 24px var(--hero-glow));
  }
}

.pill {
  transition: transform 0.2s, background 0.2s;
}

.pill:hover {
  transform: scale(1.05);
  background: var(--accent-soft);
  color: var(--accent);
}

/* Commands */
.cmd-item {
  transition: border-color 0.2s, box-shadow 0.2s;
}

.cmd-item:hover {
  border-color: var(--accent);
  box-shadow: -3px 0 0 var(--accent), var(--shadow);
}

.cmd-usage li {
  position: relative;
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
  border: 1px solid transparent;
}

.cmd-usage li:hover {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(88, 101, 242, 0.35);
  box-shadow: 0 0 0 1px rgba(88, 101, 242, 0.15);
}

.cmd-usage li::before {
  content: "Click to copy";
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.cmd-usage li:hover::before {
  opacity: 0.85;
}

.cmd-usage li.copied::before {
  content: "Copied!";
  opacity: 1;
  color: var(--success);
}

.cmd-usage li.copied::after {
  content: none;
}

.page-hero h1 {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-card code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
}

/* Scroll reveal */
.reveal-init {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Custom arrow cursor (desktop / fine pointer only) */
@media (pointer: fine) and (min-width: 769px) {
  html.hex-cursor-active,
  html.hex-cursor-active * {
    cursor: none !important;
  }
}

.hex-cursor {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100000;
  width: 0;
  height: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  will-change: transform;
  color: rgba(255, 255, 255, 0.95);
}

.hex-cursor.is-visible {
  opacity: 1;
}

.hex-cursor-shape {
  position: absolute;
  left: 0;
  top: 0;
  display: none;
  pointer-events: none;
  transition: transform 0.18s ease, opacity 0.18s ease, filter 0.18s ease;
}

.hex-cursor:not(.is-mode-link):not(.is-mode-copy):not(.is-mode-interactive) .hex-cursor-shape--arrow {
  display: block;
}

.hex-cursor.is-mode-link .hex-cursor-shape--arrow,
.hex-cursor.is-mode-copy .hex-cursor-shape--arrow,
.hex-cursor.is-mode-interactive .hex-cursor-shape--arrow {
  display: none;
}

.hex-cursor.is-mode-link .hex-cursor-shape--link,
.hex-cursor.is-mode-copy .hex-cursor-shape--copy,
.hex-cursor.is-mode-interactive .hex-cursor-shape--arrow {
  display: block;
}

.hex-cursor-arrow {
  width: 28px;
  height: 28px;
  margin: -2px 0 0 -2px;
  transform: translate(-1px, -1px);
  filter: drop-shadow(0 0 6px rgba(88, 101, 242, 0.85)) drop-shadow(0 0 14px rgba(77, 159, 255, 0.55));
}

.hex-cursor-link-icon {
  margin: -18px 0 0 -18px;
  color: #7eb8ff;
  filter: drop-shadow(0 0 8px rgba(126, 184, 255, 0.9)) drop-shadow(0 0 16px rgba(88, 101, 242, 0.6));
  animation: hex-cursor-link-spin 4s linear infinite;
}

.hex-cursor-copy-icon {
  margin: -15px 0 0 -12px;
  color: #3dd68c;
  filter: drop-shadow(0 0 8px rgba(61, 214, 140, 0.85)) drop-shadow(0 0 14px rgba(35, 165, 89, 0.45));
}

.hex-cursor-tip {
  position: absolute;
  left: 22px;
  top: -6px;
  padding: 0.2rem 0.5rem;
  font-family: var(--font);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0f1117;
  background: #3dd68c;
  border-radius: 6px;
  opacity: 0;
  transform: translateY(4px) scale(0.9);
  transition: opacity 0.15s, transform 0.15s;
  box-shadow: 0 4px 14px rgba(61, 214, 140, 0.45);
  white-space: nowrap;
}

.hex-cursor.is-mode-copy .hex-cursor-tip {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.hex-cursor.is-mode-copy.is-copied .hex-cursor-tip {
  background: var(--success);
}

.hex-cursor.is-mode-interactive .hex-cursor-arrow {
  transform: translate(-1px, -1px) scale(1.12);
  filter: drop-shadow(0 0 10px rgba(126, 184, 255, 1)) drop-shadow(0 0 22px rgba(88, 101, 242, 0.75));
}

.hex-cursor-glow {
  position: absolute;
  left: 8px;
  top: 8px;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(126, 184, 255, 0.55) 0%, rgba(88, 101, 242, 0.2) 45%, transparent 70%);
  animation: hex-cursor-pulse 2s ease-in-out infinite;
}

.hex-cursor-glow--outer {
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  left: 8px;
  top: 8px;
  background: radial-gradient(circle, rgba(88, 101, 242, 0.25) 0%, transparent 65%);
  animation: hex-cursor-pulse-outer 2.4s ease-in-out infinite;
  animation-delay: 0.35s;
}

.hex-cursor.is-mode-link .hex-cursor-glow,
.hex-cursor.is-mode-copy .hex-cursor-glow {
  animation-duration: 1s;
}

.hex-cursor.is-mode-link .hex-cursor-glow {
  background: radial-gradient(circle, rgba(126, 184, 255, 0.65) 0%, rgba(88, 101, 242, 0.25) 50%, transparent 70%);
}

.hex-cursor.is-mode-copy .hex-cursor-glow {
  background: radial-gradient(circle, rgba(61, 214, 140, 0.55) 0%, rgba(35, 165, 89, 0.2) 50%, transparent 70%);
}

.hex-cursor.is-click .hex-cursor-shape {
  transform: scale(0.88);
}

@keyframes hex-cursor-link-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@keyframes hex-cursor-pulse {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1.25);
  }
}

@keyframes hex-cursor-pulse-outer {
  0%,
  100% {
    opacity: 0.25;
    transform: scale(0.9);
  }
  50% {
    opacity: 0.65;
    transform: scale(1.15);
  }
}

[data-theme="dark"] .hex-cursor-arrow {
  filter: drop-shadow(0 0 8px rgba(114, 137, 218, 0.95)) drop-shadow(0 0 18px rgba(77, 159, 255, 0.65));
}

@media (prefers-reduced-motion: reduce) {
  .bg-mesh::before,
  .bg-mesh::after,
  .orb,
  .hero h1 span,
  .logo-mark,
  .hero-badge,
  .price-card.featured,
  .cmd-item,
  .sk-line,
  .hex-cursor-glow,
  .hex-cursor-glow--outer,
  .hex-cursor-link-icon {
    animation: none;
    opacity: 0.6;
  }

  .cmd-list.is-swapping,
  .app-view.is-exiting,
  .app-view.is-entering {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .reveal-init {
    opacity: 1;
    transform: none;
  }
}
