:root {
  --bg: #060b18;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --violet: #8b5cf6;
  --line: rgba(148, 163, 184, .14);
  --glass-bg: rgba(10, 16, 32, .62);
  --glass-border: rgba(160, 200, 255, .18);
  --glass-blur: 24px;
  --radius: 16px;
  --radius-btn: 12px;
  --section-gap: clamp(80px, 12vh, 160px);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --font: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --header-h: 72px;
  --header-h-scrolled: 56px;
  --container: 1200px;
}

/* ========== Reset ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: #fff;
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 1.2;
  overflow-wrap: break-word;
}

p {
  overflow-wrap: break-word;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 4px;
}

::selection {
  background: rgba(96, 165, 250, .35);
  color: #fff;
}

/* ========== Accessibility ========== */
.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1000;
  padding: 8px 16px;
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
  border-radius: var(--radius-btn);
  transform: translateY(-200%);
  transition: transform .3s var(--ease-out);
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ========== Body ========== */
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

body.nav-open {
  overflow: hidden;
}

/* ========== Header ========== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  transition: height .4s var(--ease-out), background-color .4s var(--ease-out), box-shadow .4s var(--ease-out);
}

.site-header.scrolled {
  height: var(--header-h-scrolled);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .32);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.logo img,
.logo svg {
  width: 32px;
  height: 32px;
}

.main-nav ul {
  display: flex;
  align-items: center;
  gap: 32px;
}

.main-nav a {
  position: relative;
  display: inline-block;
  padding: 8px 0;
  color: var(--muted);
  font-size: 15px;
  font-weight: 500;
  transition: color .3s var(--ease-out);
}

.main-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform .4s var(--ease-out);
}

.main-nav a:hover,
.main-nav a:focus-visible {
  color: var(--text);
}

.main-nav a:hover::after,
.main-nav a:focus-visible::after {
  transform: scaleX(1);
}

.main-nav a.active,
.main-nav a[aria-current="page"] {
  color: #fff;
}

.main-nav a.active::after,
.main-nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-btn);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: transform .4s var(--ease-spring), background-color .3s var(--ease-out), border-color .3s var(--ease-out), box-shadow .3s var(--ease-out), color .3s var(--ease-out);
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0) scale(.98);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: .5;
  pointer-events: none;
}

.btn-solid {
  background: linear-gradient(135deg, var(--accent), var(--violet));
  color: #fff;
  box-shadow: 0 8px 24px rgba(96, 165, 250, .24);
}

.btn-solid:hover {
  box-shadow: 0 16px 40px rgba(139, 92, 246, .36);
}

.btn-ghost {
  background: rgba(255, 255, 255, .04);
  border-color: var(--glass-border);
  color: var(--text);
}

.btn-ghost:hover {
  background: rgba(96, 165, 250, .1);
  border-color: rgba(96, 165, 250, .48);
  color: #fff;
}

.btn-lg {
  min-height: 56px;
  padding: 16px 32px;
  font-size: 16px;
  border-radius: var(--radius);
}

/* ========== Nav toggle ========== */
.nav-toggle {
  display: none;
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, .04);
}

.nav-toggle span,
.nav-toggle::before,
.nav-toggle::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 16px;
  height: 2px;
  margin-left: -8px;
  border-radius: 2px;
  background: var(--text);
  transition: transform .4s var(--ease-out), opacity .3s var(--ease-out);
}

.nav-toggle::before {
  top: 13px;
}

.nav-toggle span {
  top: 19px;
}

.nav-toggle::after {
  top: 25px;
}

.nav-toggle[aria-expanded="true"]::before {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"]::after {
  transform: translateY(-6px) rotate(-45deg);
}

/* ========== Mobile nav ========== */
.mobile-nav {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99;
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  background: var(--glass-bg);
  border-top: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .4s var(--ease-out), transform .4s var(--ease-out), visibility 0s linear .4s;
  overflow-y: auto;
}

.site-header.scrolled ~ .mobile-nav,
.site-header.scrolled .mobile-nav {
  top: var(--header-h-scrolled);
}

.mobile-nav a {
  display: block;
  padding: 16px;
  border-radius: var(--radius-btn);
  color: var(--text);
  font-size: 18px;
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  transition: background-color .3s var(--ease-out), color .3s var(--ease-out);
}

.mobile-nav a:hover,
.mobile-nav a.active {
  background: rgba(96, 165, 250, .08);
  color: #fff;
}

.mobile-nav .btn {
  margin-top: 16px;
  width: 100%;
}

.mobile-nav.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity .4s var(--ease-out), transform .4s var(--ease-out), visibility 0s linear 0s;
}

/* ========== Hero ========== */
#hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 96px 24px;
  margin-top: calc(var(--header-h) * -1);
  overflow: hidden;
  isolation: isolate;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(6, 11, 24, .56) 0%, rgba(6, 11, 24, .72) 60%, var(--bg) 100%),
    url("assets/hero.png") center / cover no-repeat;
  background-color: var(--bg);
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  overflow: hidden;
}

.parallax-layer {
  position: absolute;
  inset: -8%;
  will-change: transform;
  transition: transform .8s var(--ease-out);
}

.parallax-layer:nth-of-type(1),
.parallax-layer.layer-1 {
  background: radial-gradient(48% 40% at 20% 30%, rgba(96, 165, 250, .22), transparent 70%);
}

.parallax-layer:nth-of-type(2),
.parallax-layer.layer-2 {
  background: radial-gradient(40% 36% at 80% 64%, rgba(139, 92, 246, .24), transparent 70%);
}

.parallax-layer:nth-of-type(3),
.parallax-layer.layer-3 {
  background:
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 64% 56% at 50% 50%, #000 30%, transparent 80%);
  mask-image: radial-gradient(ellipse 64% 56% at 50% 50%, #000 30%, transparent 80%);
  opacity: .48;
}

#particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero-content {
  position: relative;
  max-width: 880px;
  margin: 0 auto;
}

#hero h1 {
  font-size: clamp(40px, 7vw, 88px);
  line-height: 1.08;
  margin-bottom: 24px;
  background: linear-gradient(180deg, #fff 40%, rgba(226, 232, 240, .72));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-tagline {
  display: inline-block;
  margin-bottom: 24px;
  padding: 8px 16px;
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  background: rgba(96, 165, 250, .08);
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .08em;
}

.hero-desc {
  max-width: 640px;
  margin: 0 auto 40px;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.7;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
}

/* ========== Glass input / typewriter ========== */
.glass-input {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 640px;
  min-height: 64px;
  margin: 0 auto;
  padding: 8px 8px 8px 24px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  box-shadow: 0 16px 48px rgba(0, 0, 0, .32), inset 0 1px 0 rgba(255, 255, 255, .06);
  text-align: left;
  transition: border-color .3s var(--ease-out), box-shadow .3s var(--ease-out);
}

.glass-input:focus-within {
  border-color: rgba(96, 165, 250, .56);
  box-shadow: 0 16px 48px rgba(0, 0, 0, .32), 0 0 0 4px rgba(96, 165, 250, .16);
}

.glass-input input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font-size: 16px;
}

.glass-input input::placeholder {
  color: var(--muted);
}

#typewriter {
  flex: 1;
  min-width: 0;
  min-height: 1.7em;
  color: var(--text);
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.caret {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  margin-left: 2px;
  vertical-align: -0.2em;
  background: var(--accent);
  border-radius: 1px;
  animation: caret-blink 1s steps(1, end) infinite;
}

@keyframes caret-blink {
  0%,
  50% {
    opacity: 1;
  }
  50.01%,
  100% {
    opacity: 0;
  }
}

/* ========== Split sections ========== */
#chat,
#workspace {
  position: relative;
  padding: var(--section-gap) 24px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 64px;
  max-width: var(--container);
  margin: 0 auto;
}

#workspace .split .text-col {
  order: 2;
}

#workspace .split .image-col {
  order: 1;
}

.text-col h2 {
  font-size: clamp(32px, 4.5vw, 48px);
  margin-bottom: 24px;
}

.text-col > p {
  color: var(--muted);
  font-size: 17px;
  margin-bottom: 32px;
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.feature-list li {
  position: relative;
  padding: 16px 16px 16px 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  background: rgba(255, 255, 255, .02);
  color: var(--text);
  transition: border-color .3s var(--ease-out), background-color .3s var(--ease-out), transform .4s var(--ease-out);
}

.feature-list li::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 24px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  box-shadow: 0 0 16px rgba(96, 165, 250, .48);
}

.feature-list li:hover {
  border-color: var(--glass-border);
  background: rgba(96, 165, 250, .05);
  transform: translateX(4px);
}

.feature-list strong {
  display: block;
  color: #fff;
  font-weight: 700;
  margin-bottom: 0;
}

.feature-list span,
.feature-list p {
  color: var(--muted);
  font-size: 15px;
}

.image-col {
  position: relative;
  perspective: 1200px;
}

.image-col::before {
  content: "";
  position: absolute;
  inset: 8% 8%;
  z-index: -1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(139, 92, 246, .32), transparent 70%);
  filter: blur(48px);
}

.tilt-card {
  position: relative;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .48), inset 0 1px 0 rgba(255, 255, 255, .06);
  overflow: hidden;
  transform-style: preserve-3d;
  transform: perspective(1200px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .6s var(--ease-out), box-shadow .6s var(--ease-out);
  will-change: transform;
}

.tilt-card:hover {
  box-shadow: 0 32px 80px rgba(0, 0, 0, .56), 0 0 0 1px rgba(96, 165, 250, .24);
}

.tilt-card img {
  width: 100%;
  height: auto;
  border-radius: inherit;
}

.tilt-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, .12), transparent 40%);
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s var(--ease-out);
}

.tilt-card:hover::after {
  opacity: 1;
}

/* ========== Glass fallback ========== */
@supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .site-header,
  .mobile-nav {
    background: rgba(10, 16, 32, .96);
  }

  .glass-input,
  .tilt-card {
    background: rgba(12, 20, 40, .94);
  }
}

/* ========== 768px ========== */
@media (max-width: 768px) {
  :root {
    --header-h: 64px;
    --header-h-scrolled: 56px;
  }

  .header-inner {
    padding: 0 16px;
  }

  .main-nav,
  .header-actions .btn {
    display: none;
  }

  .nav-toggle {
    display: inline-block;
  }

  .mobile-nav {
    display: flex;
  }

  #hero {
    padding: 96px 16px 64px;
  }

  .hero-desc {
    margin-bottom: 32px;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .btn {
    width: 100%;
  }

  .glass-input {
    min-height: 56px;
    padding: 8px 8px 8px 16px;
  }

  .glass-input .btn {
    padding: 8px 16px;
  }

  #chat,
  #workspace {
    padding: var(--section-gap) 16px;
  }

  .split {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  #workspace .split .text-col,
  #workspace .split .image-col {
    order: 0;
  }

  .tilt-card {
    transform: none;
  }

  .feature-list li:hover {
    transform: none;
  }
}

@media (min-width: 769px) {
  .mobile-nav {
    display: none !important;
  }
}

#comic {
  position: relative;
  padding: clamp(64px, 10vw, 128px) 0;
}

.full-width {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  padding-left: clamp(16px, 4vw, 48px);
  padding-right: clamp(16px, 4vw, 48px);
  box-sizing: border-box;
}

.arc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: clamp(16px, 2.4vw, 32px);
  margin-top: clamp(32px, 5vw, 56px);
  list-style: none;
  padding: 0;
}

.flip-card {
  position: relative;
  min-height: 360px;
  perspective: 1200px;
  outline: none;
  opacity: 0;
  transform: translateY(32px) scale(0.97);
  transition:
    opacity 0.6s var(--ease, cubic-bezier(0.22, 1, 0.36, 1)),
    transform 0.6s var(--ease, cubic-bezier(0.22, 1, 0.36, 1));
}

.flip-card.visible {
  opacity: 1;
  transform: none;
}

.flip-card:nth-child(2) { transition-delay: 0.08s; }
.flip-card:nth-child(3) { transition-delay: 0.16s; }
.flip-card:nth-child(4) { transition-delay: 0.24s; }
.flip-card:nth-child(5) { transition-delay: 0.32s; }
.flip-card:nth-child(6) { transition-delay: 0.40s; }
.flip-card:nth-child(7) { transition-delay: 0.48s; }

.flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: inherit;
  transform-style: preserve-3d;
  transition: transform 0.7s var(--ease, cubic-bezier(0.22, 1, 0.36, 1));
}

.flip-card:hover .flip-inner,
.flip-card:focus-within .flip-inner {
  transform: rotateY(180deg);
}

.flip-card:focus-visible .flip-inner,
.flip-card:focus-within .flip-inner {
  box-shadow: 0 0 0 3px var(--accent, #7c5cff);
  border-radius: var(--radius, 16px);
}

.front,
.back {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius, 16px);
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.front {
  background: var(--surface, #15151f);
  justify-content: flex-end;
}

.front img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.front::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.75) 100%);
  pointer-events: none;
}

.front > :not(img) {
  position: relative;
  z-index: 2;
  margin: 0;
  padding: 20px 22px;
  color: #fff;
}

.back {
  transform: rotateY(180deg);
  justify-content: center;
  gap: 12px;
  padding: 28px 24px;
  background:
    linear-gradient(145deg, var(--accent, #7c5cff) 0%, var(--accent-2, #22d3ee) 100%);
  color: #fff;
}

.back h3,
.back h4 {
  margin: 0;
  font-size: 1.25rem;
}

.back p {
  margin: 0;
  line-height: 1.6;
  opacity: 0.92;
}

#storyboard {
  position: relative;
  padding: clamp(64px, 10vw, 128px) 0;
}

.board-wall {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: clamp(6px, 1vw, 12px);
  aspect-ratio: 16 / 9;
  max-width: 1200px;
  margin: clamp(32px, 5vw, 56px) auto 0;
}

.board-cell {
  position: relative;
  border: 0;
  padding: 0;
  border-radius: calc(var(--radius, 16px) * 0.5);
  background-color: var(--surface, #15151f);
  background-repeat: no-repeat;
  background-size: 300% 300%;
  cursor: zoom-in;
  overflow: hidden;
  transition:
    transform 0.35s var(--ease, cubic-bezier(0.22, 1, 0.36, 1)),
    opacity 0.35s ease,
    filter 0.35s ease,
    box-shadow 0.35s ease;
}

.board-cell::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px var(--border, rgba(255, 255, 255, 0.12));
  pointer-events: none;
}

.board-cell:focus-visible {
  outline: 3px solid var(--accent, #7c5cff);
  outline-offset: 3px;
}

.hover,
.board-cell.hover {
  z-index: 2;
  transform: scale(1.06);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
}

.dimmed,
.board-cell.dimmed {
  opacity: 0.35;
  filter: grayscale(0.6) blur(1px);
}

#lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

#lightbox.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.3s ease, visibility 0s linear 0s;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 5, 10, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.lightbox-view {
  position: relative;
  z-index: 1;
  width: min(92vw, 1100px);
  aspect-ratio: 16 / 9;
  max-height: 82vh;
  border-radius: var(--radius, 16px);
  background-color: var(--surface, #15151f);
  background-repeat: no-repeat;
  background-size: contain;
  background-position: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
  transform: scale(0.94);
  transition: transform 0.35s var(--ease, cubic-bezier(0.22, 1, 0.36, 1));
}

#lightbox.open .lightbox-view {
  transform: scale(1);
}

.lightbox-view img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: inherit;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lightbox-close:focus-visible,
.lightbox-prev:focus-visible,
.lightbox-next:focus-visible {
  outline: 3px solid var(--accent, #7c5cff);
  outline-offset: 2px;
}

.lightbox-close {
  top: clamp(12px, 3vw, 28px);
  right: clamp(12px, 3vw, 28px);
}

.lightbox-prev,
.lightbox-next {
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-prev {
  left: clamp(8px, 3vw, 32px);
}

.lightbox-next {
  right: clamp(8px, 3vw, 32px);
}

.lightbox-prev:hover {
  transform: translateY(-50%) translateX(-2px);
}

.lightbox-next:hover {
  transform: translateY(-50%) translateX(2px);
}

#devices {
  position: relative;
  padding: clamp(64px, 10vw, 128px) 0;
}

.info-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: clamp(16px, 2vw, 28px);
  margin-top: clamp(32px, 5vw, 56px);
  list-style: none;
  padding: 0;
}

.info-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 28px 24px;
  border-radius: var(--radius, 16px);
  background: var(--surface, #15151f);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  transition:
    transform 0.3s var(--ease, cubic-bezier(0.22, 1, 0.36, 1)),
    border-color 0.3s ease,
    box-shadow 0.3s ease;
}

.info-card:hover,
.info-card:focus-within {
  transform: translateY(-6px);
  border-color: var(--accent, #7c5cff);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

.info-card h3 {
  margin: 0;
  font-size: 1.15rem;
}

.info-card p {
  margin: 0;
  color: var(--muted, #a0a0b8);
  line-height: 1.6;
}

#extend {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: clamp(32px, 6vw, 96px);
  padding: clamp(64px, 10vw, 128px) clamp(16px, 4vw, 48px);
  overflow: hidden;
}

.extend-left {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.extend-left p {
  margin: 0;
  color: var(--muted, #a0a0b8);
  line-height: 1.7;
}

.extend-right {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 420px;
}

.drag-sphere {
  position: relative;
  width: clamp(180px, 26vw, 300px);
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.85) 0%, rgba(255, 255, 255, 0) 30%),
    radial-gradient(circle at 50% 50%, var(--accent-2, #22d3ee) 0%, var(--accent, #7c5cff) 70%, #1a1033 100%);
  box-shadow:
    0 30px 60px rgba(0, 0, 0, 0.45),
    inset -18px -24px 48px rgba(0, 0, 0, 0.35);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
  z-index: 1;
}

.drag-sphere:active {
  cursor: grabbing;
}

.drag-sphere:focus-visible {
  outline: 3px solid var(--accent, #7c5cff);
  outline-offset: 6px;
}

.pulse-shield {
  position: relative;
  display: grid;
  place-items: center;
}

.pulse-shield img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
}

.pulse-shield::after {
  content: "";
  position: absolute;
  inset: 12%;
  border-radius: 50%;
  pointer-events: none;
  box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.4);
  animation: pulse 2s infinite;
}

.pulse-shield + .pulse-shield {
  animation-delay: 1.2s;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(96, 165, 250, 0.4); }
  100% { box-shadow: 0 0 0 30px rgba(96, 165, 250, 0); }
}

#download {
  position: relative;
  padding: clamp(64px, 10vw, 128px) 0;
  text-align: center;
}

.platform-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 28px);
  max-width: 1080px;
  margin: clamp(32px, 5vw, 56px) auto 0;
  list-style: none;
  padding: 0;
}

.platform-card {
  --mx: 50%;
  --my: 50%;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 36px 24px;
  border-radius: var(--radius, 16px);
  background: var(--surface, #15151f);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition:
    transform 0.3s var(--ease, cubic-bezier(0.22, 1, 0.36, 1)),
    border-color 0.3s ease;
}

.platform-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(
    circle 220px at var(--mx) var(--my),
    color-mix(in srgb, var(--accent, #7c5cff) 45%, transparent) 0%,
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.platform-card:hover,
.platform-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--accent, #7c5cff);
}

.platform-card:hover::before,
.platform-card:focus-visible::before {
  opacity: 1;
}

.platform-card:focus-visible {
  outline: 3px solid var(--accent, #7c5cff);
  outline-offset: 3px;
}

.platform-card svg,
.platform-card img {
  width: 48px;
  height: 48px;
}

.site-footer {
  padding: 40px clamp(16px, 4vw, 48px);
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  color: var(--muted, #a0a0b8);
  font-size: 0.875rem;
  text-align: center;
}

.site-footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer a:hover {
  color: var(--text, #f2f2f7);
}

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.7s var(--ease, cubic-bezier(0.22, 1, 0.36, 1)),
    transform 0.7s var(--ease, cubic-bezier(0.22, 1, 0.36, 1));
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

.img-fallback {
  position: relative;
}

.img-fallback.is-failed,
.broken {
  position: relative;
  background-color: var(--surface, #15151f);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(135deg, color-mix(in srgb, var(--accent, #7c5cff) 35%, transparent) 0%, color-mix(in srgb, var(--accent-2, #22d3ee) 25%, transparent) 100%);
  background-size: 24px 24px, 24px 24px, 100% 100%;
}

.img-fallback.is-failed img,
.broken img {
  visibility: hidden;
}

.img-fallback.is-failed::after,
.broken::after {
  content: attr(data-fallback);
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 16px;
  color: var(--muted, #a0a0b8);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-align: center;
  pointer-events: none;
}

@media (max-width: 768px) {
  #extend {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .extend-left {
    align-items: center;
  }

  .extend-right {
    min-height: 320px;
  }

  .arc-cards,
  .info-cards {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 16px 12px;
    margin-left: -16px;
    margin-right: -16px;
  }

  .arc-cards::-webkit-scrollbar,
  .info-cards::-webkit-scrollbar {
    display: none;
  }

  .arc-cards > .flip-card,
  .info-cards > .info-card {
    flex: 0 0 78%;
    scroll-snap-align: center;
  }

  .flip-card {
    min-height: 320px;
  }

  .board-wall {
    aspect-ratio: 4 / 3;
    gap: 6px;
  }

  .platform-cards {
    grid-template-columns: 1fr;
    max-width: 420px;
  }

  .platform-card {
    flex-direction: row;
    justify-content: flex-start;
    padding: 20px;
    text-align: left;
  }

  .lightbox-view {
    width: 94vw;
  }

  .lightbox-prev,
  .lightbox-next {
    top: auto;
    bottom: 24px;
    transform: none;
  }

  .lightbox-prev:hover,
  .lightbox-next:hover {
    transform: none;
  }

  .lightbox-prev {
    left: calc(50% - 60px);
  }

  .lightbox-next {
    right: calc(50% - 60px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }

  .reveal,
  .flip-card {
    opacity: 1;
    transform: none;
  }

  .pulse-shield,
  .pulse-shield::after {
    animation: none;
    transform: none;
  }

  .hover,
  .board-cell.hover,
  .info-card:hover,
  .info-card:focus-within,
  .platform-card:hover,
  .platform-card:focus-visible {
    transform: none;
  }
}
