:root {
  color-scheme: light;
  --brand-50: hsl(204 100% 97%);
  --brand-100: hsl(204 100% 92%);
  --brand-200: hsl(205 100% 86%);
  --brand-300: hsl(204 100% 77%);
  --brand-400: hsl(203 100% 66%);
  --brand-500: hsl(207 90% 54%);
  --brand-600: hsl(207 90% 43%);
  --brand-700: hsl(207 90% 35%);
  --brand-800: hsl(207 85% 29%);
  --brand-900: hsl(207 77% 25%);
  --slate-50: hsl(210 40% 98%);
  --slate-100: hsl(210 40% 96%);
  --slate-200: hsl(214 32% 91%);
  --slate-300: hsl(213 27% 84%);
  --slate-600: hsl(215 16% 47%);
  --slate-700: hsl(215 25% 27%);
  --slate-800: hsl(217 33% 17%);
  --slate-900: hsl(222 47% 11%);
  --slate-950: hsl(229 84% 5%);
  --emerald-500: hsl(160 84% 39%);
  --violet-600: hsl(262 83% 58%);
  --amber-500: hsl(38 92% 50%);
  --coral-500: hsl(0 84% 60%);
  --surface: hsl(0 0% 100% / 0.76);
  --surface-strong: hsl(0 0% 100% / 0.92);
  --surface-soft: hsl(210 40% 98% / 0.72);
  --text: hsl(229 84% 5%);
  --muted: hsl(215 16% 38%);
  --line: hsl(210 40% 100% / 0.62);
  --line-strong: hsl(214 32% 91%);
  --ring: hsl(204 100% 77% / 0.55);
  --shadow-sm: 0 1px 2px hsl(229 84% 5% / 0.07), 0 4px 14px hsl(229 84% 5% / 0.06);
  --shadow-paper: 0 18px 50px hsl(229 84% 5% / 0.16), 0 1px 0 hsl(0 0% 100% / 0.45) inset;
  --shadow-glow: 0 24px 80px hsl(207 90% 54% / 0.28), 0 10px 28px hsl(262 83% 58% / 0.12);
  --shadow-hover: 0 30px 90px hsl(207 90% 54% / 0.34), 0 12px 36px hsl(229 84% 5% / 0.14);
  --radius-xl: 1.25rem;
  --radius-2xl: 1.5rem;
  --radius-3xl: 2rem;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

.dark {
  color-scheme: dark;
  --surface: hsl(222 47% 11% / 0.76);
  --surface-strong: hsl(222 47% 11% / 0.94);
  --surface-soft: hsl(229 84% 5% / 0.74);
  --text: hsl(210 40% 98%);
  --muted: hsl(214 32% 82%);
  --line: hsl(215 25% 27% / 0.78);
  --line-strong: hsl(215 25% 27%);
  --ring: hsl(207 90% 54% / 0.5);
  --shadow-sm: 0 1px 2px hsl(0 0% 0% / 0.25), 0 4px 18px hsl(0 0% 0% / 0.18);
  --shadow-paper: 0 18px 52px hsl(0 0% 0% / 0.38), 0 1px 0 hsl(0 0% 100% / 0.08) inset;
  --shadow-glow: 0 24px 84px hsl(207 90% 54% / 0.22), 0 12px 44px hsl(262 83% 58% / 0.16);
  --shadow-hover: 0 34px 96px hsl(207 90% 54% / 0.28), 0 16px 46px hsl(0 0% 0% / 0.34);
}

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

html {
  min-width: 320px;
  text-rendering: geometricPrecision;
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  overflow-x: hidden;
}

p,
h1,
h2,
h3,
h4,
h5,
h6,
span,
div,
a,
button,
label,
input,
select,
textarea,
output,
li,
dt,
dd,
figcaption,
blockquote {
  overflow-wrap: break-word;
  word-wrap: break-word;
  min-width: 0;
}

img,
picture,
video,
canvas,
svg,
iframe {
  max-width: 100%;
}

img,
video,
canvas {
  height: auto;
}

svg {
  flex-shrink: 0;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button,
select,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.58;
  filter: grayscale(0.2);
}

::selection {
  color: white;
  background: hsl(207 90% 35%);
}

.dark ::selection {
  color: hsl(229 84% 5%);
  background: hsl(204 100% 77%);
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: hsl(210 40% 96%);
}

::-webkit-scrollbar-thumb {
  min-height: 44px;
  border: 3px solid hsl(210 40% 96%);
  border-radius: 999px;
  background: linear-gradient(180deg, hsl(207 90% 54%), hsl(262 83% 58%));
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, hsl(207 90% 35%), hsl(262 83% 48%));
}

.dark ::-webkit-scrollbar-track {
  background: hsl(229 84% 5%);
}

.dark ::-webkit-scrollbar-thumb {
  border-color: hsl(229 84% 5%);
  background: linear-gradient(180deg, hsl(204 100% 77%), hsl(262 83% 68%));
}

.hidden,
[hidden] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

#app-shell {
  isolation: isolate;
}

#app-shell::before,
#app-shell::after {
  content: "";
  position: fixed;
  z-index: -1;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(48px);
  opacity: 0.55;
  transform: translateZ(0);
}

#app-shell::before {
  top: 8rem;
  left: max(-8rem, -12vw);
  width: min(28rem, 70vw);
  height: min(28rem, 70vw);
  background: radial-gradient(circle, hsl(207 90% 54% / 0.32), transparent 68%);
  animation: float-orb 15s var(--ease-out) infinite alternate;
}

#app-shell::after {
  right: max(-10rem, -14vw);
  bottom: 6rem;
  width: min(34rem, 78vw);
  height: min(34rem, 78vw);
  background: radial-gradient(circle, hsl(262 83% 58% / 0.22), hsl(160 84% 39% / 0.13), transparent 70%);
  animation: float-orb 18s var(--ease-out) infinite alternate-reverse;
}

#site-header {
  transition: background-color 220ms var(--ease-out), border-color 220ms var(--ease-out), box-shadow 220ms var(--ease-out);
}

#brand-home-link span:first-child {
  position: relative;
  overflow: hidden;
}

#brand-home-link span:first-child::after {
  content: "";
  position: absolute;
  inset: -60%;
  background: linear-gradient(110deg, transparent 30%, hsl(0 0% 100% / 0.38), transparent 70%);
  transform: translateX(-90%) rotate(12deg);
  transition: transform 700ms var(--ease-out);
}

#brand-home-link:hover span:first-child::after {
  transform: translateX(90%) rotate(12deg);
}

#desktop-navigation-links a,
#mobile-navigation-panel a,
#hero-actions a,
#hero-actions button,
button {
  transform: translateZ(0);
}

#desktop-navigation-links a:hover,
#mobile-navigation-panel a:hover,
button:hover,
#hero-actions a:hover {
  box-shadow: var(--shadow-sm);
}

:is(a, button, input, select, textarea, label):focus-visible {
  outline: 3px solid transparent;
  box-shadow: 0 0 0 4px var(--ring), 0 0 0 1px hsl(207 90% 35% / 0.45) inset;
}

.dark :is(a, button, input, select, textarea, label):focus-visible {
  box-shadow: 0 0 0 4px var(--ring), 0 0 0 1px hsl(204 100% 77% / 0.45) inset;
}

#mobile-navigation-panel:not(.hidden) {
  animation: slide-down 260ms var(--ease-out) both;
}

#hero-section,
#workbench-section,
#models-section,
#science-section,
#challenge-section {
  scroll-margin-top: 96px;
}

#hero-copy {
  animation: fade-up 700ms var(--ease-out) both;
}

#hero-visual {
  animation: fade-up 820ms var(--ease-out) 80ms both;
}

#hero-stats > div,
#control-panel,
#fold-step-panel,
#results-panel > section,
#model-gallery > article,
#science-principles-grid > article,
#challenge-section > div {
  transition: transform 260ms var(--ease-out), box-shadow 260ms var(--ease-out), border-color 260ms var(--ease-out), background-color 260ms var(--ease-out);
}

#hero-stats > div:hover,
#control-panel:hover,
#fold-step-panel:hover,
#results-panel > section:hover,
#science-principles-grid > article:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  border-color: hsl(207 90% 54% / 0.35);
}

#paper-airplane-preview-card {
  position: relative;
  overflow: hidden;
}

#paper-airplane-preview-card::before {
  content: "";
  position: absolute;
  inset: -1px;
  pointer-events: none;
  background:
    linear-gradient(120deg, transparent 0 28%, hsl(0 0% 100% / 0.12) 36%, transparent 46%),
    radial-gradient(circle at 20% 18%, hsl(204 100% 77% / 0.22), transparent 28%);
  animation: sheen 5s ease-in-out infinite;
}

#paper-airplane-preview-card > * {
  position: relative;
  z-index: 1;
}

#airplane-stage,
#fold-canvas {
  position: relative;
}

#airplane-stage::before,
#fold-canvas::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(hsl(207 90% 54% / 0.08) 1px, transparent 1px),
    linear-gradient(90deg, hsl(207 90% 54% / 0.08) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at center, black, transparent 78%);
}

.dark #airplane-stage::before,
.dark #fold-canvas::before {
  background-image:
    linear-gradient(hsl(204 100% 77% / 0.08) 1px, transparent 1px),
    linear-gradient(90deg, hsl(204 100% 77% / 0.08) 1px, transparent 1px);
}

#airplane-origami-object,
#fold-paper-illustration {
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 22px 28px hsl(229 84% 5% / 0.18));
  animation: plane-hover 4.8s ease-in-out infinite;
  transform-origin: 50% 50%;
}

#fold-paper-illustration {
  animation-duration: 5.8s;
}

#airplane-origami-object::after,
#fold-paper-illustration::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: -1.4rem;
  height: 1.4rem;
  border-radius: 999px;
  background: hsl(229 84% 5% / 0.18);
  filter: blur(18px);
  animation: plane-shadow 4.8s ease-in-out infinite;
}

.dark #airplane-origami-object::after,
.dark #fold-paper-illustration::after {
  background: hsl(204 100% 77% / 0.14);
}

input[type="range"] {
  height: 1.5rem;
  background: transparent;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 0.55rem;
  border-radius: 999px;
  background: linear-gradient(90deg, hsl(207 90% 35%), hsl(204 100% 66%), hsl(160 84% 39%));
  box-shadow: inset 0 1px 2px hsl(229 84% 5% / 0.18);
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.35rem;
  height: 1.35rem;
  margin-top: -0.4rem;
  border: 3px solid white;
  border-radius: 50%;
  background: hsl(207 90% 35%);
  box-shadow: 0 6px 18px hsl(207 90% 35% / 0.36);
  transition: transform 160ms var(--ease-spring), background-color 160ms var(--ease-out);
}

input[type="range"]:hover::-webkit-slider-thumb {
  transform: scale(1.12);
  background: hsl(262 83% 48%);
}

input[type="range"]::-moz-range-track {
  height: 0.55rem;
  border-radius: 999px;
  background: linear-gradient(90deg, hsl(207 90% 35%), hsl(204 100% 66%), hsl(160 84% 39%));
}

input[type="range"]::-moz-range-thumb {
  width: 1.1rem;
  height: 1.1rem;
  border: 3px solid white;
  border-radius: 50%;
  background: hsl(207 90% 35%);
  box-shadow: 0 6px 18px hsl(207 90% 35% / 0.36);
}

.dark input[type="range"]::-webkit-slider-runnable-track,
.dark input[type="range"]::-moz-range-track {
  background: linear-gradient(90deg, hsl(204 100% 77%), hsl(262 83% 68%), hsl(160 84% 55%));
}

.dark input[type="range"]::-webkit-slider-thumb,
.dark input[type="range"]::-moz-range-thumb {
  border-color: hsl(222 47% 11%);
  background: hsl(204 100% 77%);
  box-shadow: 0 6px 18px hsl(204 100% 77% / 0.28);
}

select,
input[type="text"],
input[type="email"],
input[type="number"],
textarea {
  min-width: 0;
  max-width: 100%;
  transition: border-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out), background-color 180ms var(--ease-out);
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position:
    calc(100% - 22px) 52%,
    calc(100% - 16px) 52%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 2.75rem !important;
}

input[type="checkbox"] {
  cursor: pointer;
  border-radius: 0.35rem;
}

#distance-score-bar,
#stability-score-bar,
#hangtime-score-bar {
  position: relative;
  overflow: hidden;
}

#distance-score-bar::after,
#stability-score-bar::after,
#hangtime-score-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, hsl(0 0% 100% / 0.4), transparent);
  transform: translateX(-100%);
  animation: progress-shine 2.6s ease-in-out infinite;
}

#model-gallery article {
  will-change: transform;
}

#model-gallery article > div:first-child {
  position: relative;
  overflow: hidden;
}

#model-gallery article > div:first-child::before {
  content: "";
  position: absolute;
  inset: auto -20% -45% -20%;
  height: 72%;
  background: radial-gradient(ellipse at center, hsl(0 0% 100% / 0.26), transparent 64%);
  transition: transform 360ms var(--ease-out), opacity 360ms var(--ease-out);
}

#model-gallery article:hover > div:first-child::before {
  transform: translateY(-18%);
  opacity: 0.9;
}

#model-gallery article svg {
  position: relative;
  z-index: 1;
  transition: transform 360ms var(--ease-spring), filter 360ms var(--ease-out);
  filter: drop-shadow(0 16px 16px hsl(0 0% 0% / 0.18));
}

#model-gallery article:hover svg {
  transform: translateY(-5px) rotate(-2deg) scale(1.04);
}

#science-section > div > div:first-child,
#challenge-section > div {
  position: relative;
  overflow: hidden;
}

#science-section > div > div:first-child::after,
#challenge-section > div::after {
  content: "";
  position: absolute;
  pointer-events: none;
  inset: -40% -20% auto auto;
  width: 22rem;
  height: 22rem;
  border-radius: 999px;
  background: radial-gradient(circle, hsl(204 100% 77% / 0.22), transparent 68%);
  filter: blur(8px);
}

#challenge-entry-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  background:
    radial-gradient(circle at 18% 12%, hsl(207 90% 54% / 0.22), transparent 36%),
    radial-gradient(circle at 85% 80%, hsl(262 83% 58% / 0.2), transparent 34%),
    hsl(229 84% 5%);
}

#challenge-entry-form label {
  display: block;
  margin-bottom: 0.5rem;
  color: hsl(210 40% 98%);
  font-weight: 800;
  font-size: 0.875rem;
}

#challenge-entry-form input,
#challenge-entry-form select,
#challenge-entry-form textarea {
  width: 100%;
  border: 1px solid hsl(215 25% 27%);
  border-radius: 1rem;
  background: hsl(222 47% 11% / 0.9);
  color: white;
  padding: 0.85rem 1rem;
  font-weight: 700;
}

#challenge-entry-form input::placeholder,
#challenge-entry-form textarea::placeholder {
  color: hsl(214 32% 82% / 0.72);
}

#challenge-entry-form button,
button[type="submit"],
input[type="submit"] {
  border: 0;
  border-radius: 1rem;
  background: hsl(204 100% 77%);
  color: hsl(229 84% 5%);
  padding: 0.95rem 1.25rem;
  font-weight: 900;
  box-shadow: 0 14px 34px hsl(207 90% 54% / 0.25);
  transition: transform 180ms var(--ease-out), background-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}

#challenge-entry-form button:hover,
button[type="submit"]:hover,
input[type="submit"]:hover {
  transform: translateY(-1px);
  background: white;
  box-shadow: 0 18px 42px hsl(207 90% 54% / 0.34);
}

[id*="modal"],
.modal,
[role="dialog"],
[aria-modal="true"] {
  z-index: 1000;
}

.modal-backdrop,
[id*="backdrop"],
[role="presentation"].backdrop {
  z-index: 990;
}

[role="dialog"]:not(.hidden),
[aria-modal="true"]:not(.hidden),
.modal:not(.hidden),
[id*="modal"]:not(.hidden) {
  animation: modal-in 220ms var(--ease-out) both;
}

.loading,
[aria-busy="true"] {
  position: relative;
  pointer-events: none;
}

.loading::after,
[aria-busy="true"]::after {
  content: "";
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-left: 0.55em;
  vertical-align: -0.15em;
  border: 0.18em solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 720ms linear infinite;
}

.animate-fade-in {
  animation: fade-in 420ms var(--ease-out) both;
}

.animate-fade-up {
  animation: fade-up 520ms var(--ease-out) both;
}

.animate-pulse-soft {
  animation: pulse-soft 2.2s ease-in-out infinite;
}

@media (max-width: 1023px) {
  #site-header {
    position: sticky;
  }

  #folding-workbench-grid,
  #workbench-main-panel {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (max-width: 767px) {
  #hero-section {
    min-height: auto;
    padding-top: 3rem;
    padding-bottom: 3rem;
  }

  #airplane-stage {
    min-height: 18rem;
  }

  #fold-canvas {
    min-height: 22rem;
  }

  #fold-paper-illustration > div:nth-child(n + 2) {
    margin-top: -42%;
    height: 42vw;
    max-height: 12rem;
  }

  #main-navigation {
    gap: 0.75rem;
  }

  #theme-toggle-button {
    max-width: 5.5rem;
    padding-inline: 0.85rem;
  }

  #brand-home-link {
    max-width: calc(100vw - 9.5rem);
  }
}

@media (max-width: 479px) {
  :root {
    --radius-3xl: 1.5rem;
  }

  #site-header nav {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
  }

  #brand-home-link > span:first-child {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 1rem;
  }

  #hero-section,
  #workbench-section,
  #models-section,
  #science-section,
  #challenge-section {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  #hero-copy h1 {
    font-size: clamp(2.65rem, 14vw, 4rem);
  }

  #fold-step-panel,
  #control-panel,
  #results-panel > section {
    padding: 1rem;
    border-radius: 1.5rem;
  }

  #paper-airplane-preview-card,
  #airplane-stage,
  #fold-canvas {
    border-radius: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse-soft {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }

  50% {
    opacity: 0.72;
    transform: scale(0.985);
  }
}

@keyframes float-orb {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }

  100% {
    transform: translate3d(28px, -22px, 0) scale(1.08);
  }
}

@keyframes plane-hover {
  0%,
  100% {
    transform: translateY(0) rotate(-0.5deg);
  }

  50% {
    transform: translateY(-10px) rotate(1deg);
  }
}

@keyframes plane-shadow {
  0%,
  100% {
    opacity: 0.62;
    transform: scaleX(0.92);
  }

  50% {
    opacity: 0.34;
    transform: scaleX(0.72);
  }
}

@keyframes sheen {
  0%,
  45% {
    transform: translateX(-18%);
    opacity: 0.7;
  }

  100% {
    transform: translateX(18%);
    opacity: 1;
  }
}

@keyframes progress-shine {
  0% {
    transform: translateX(-110%);
  }

  55%,
  100% {
    transform: translateX(110%);
  }
}