:root {
  color-scheme: dark;
  --slate-950: hsl(224 47% 6%);
  --slate-900: hsl(224 42% 9%);
  --slate-850: hsl(226 38% 12%);
  --slate-800: hsl(226 32% 16%);
  --slate-700: hsl(225 24% 27%);
  --slate-300: hsl(222 28% 82%);
  --slate-200: hsl(220 34% 91%);
  --indigo-500: hsl(255 92% 68%);
  --indigo-400: hsl(252 100% 76%);
  --emerald-400: hsl(158 82% 58%);
  --cyan-400: hsl(187 100% 55%);
  --cyan-300: hsl(184 100% 68%);
  --pink-500: hsl(310 100% 58%);
  --pink-400: hsl(314 100% 70%);
  --acid: hsl(69 100% 52%);
  --text: hsl(252 100% 98%);
  --muted: hsl(248 36% 78%);
  --panel: hsl(252 55% 12% / 0.78);
  --panel-strong: hsl(252 58% 10% / 0.92);
  --glass: hsl(246 42% 18% / 0.62);
  --line: hsl(186 100% 62% / 0.55);
  --danger: hsl(348 88% 62%);
  --radius-xl: 1.25rem;
  --radius-2xl: 1.5rem;
  --shadow-blue: 0 0 22px hsl(187 100% 55% / 0.34), 0 18px 48px hsl(224 70% 2% / 0.55);
  --shadow-pink: 0 0 22px hsl(310 100% 58% / 0.32), 0 18px 48px hsl(224 70% 2% / 0.55);
  --shadow-panel: 0 24px 90px hsl(258 90% 68% / 0.18), inset 0 1px 0 hsl(0 0% 100% / 0.08);
  --focus: 0 0 0 3px hsl(69 100% 52% / 0.36), 0 0 0 1px hsl(69 100% 52%);
}

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

html {
  min-width: 320px;
  scroll-behavior: smooth;
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
  text-rendering: geometricPrecision;
}

p,
h1,
h2,
h3,
h4,
h5,
h6,
span,
div,
a,
button,
label,
legend,
li,
input,
select,
textarea {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

img,
video,
canvas,
svg {
  max-width: 100%;
  height: auto;
}

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

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

button {
  cursor: pointer;
}

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

.hidden,
[hidden] {
  display: none !important;
}

::selection {
  color: var(--slate-950);
  background: var(--acid);
  text-shadow: none;
}

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

::-webkit-scrollbar-track {
  background: hsl(224 47% 6%);
}

::-webkit-scrollbar-thumb {
  border: 3px solid hsl(224 47% 6%);
  border-radius: 999px;
  background: linear-gradient(180deg, var(--cyan-400), var(--pink-500));
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, var(--acid), var(--cyan-300));
}

@supports (scrollbar-color: auto) {
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--cyan-400) var(--slate-950);
  }
}

#app-body {
  position: relative;
  background-color: var(--slate-950);
}

#app-body::before,
#app-body::after {
  position: fixed;
  inset: auto;
  z-index: 0;
  width: min(54vw, 720px);
  height: min(54vw, 720px);
  pointer-events: none;
  content: "";
  border-radius: 999px;
  filter: blur(42px);
  opacity: 0.42;
  transform: translateZ(0);
}

#app-body::before {
  top: -18rem;
  left: -18rem;
  background: radial-gradient(circle, hsl(310 100% 58% / 0.75), transparent 64%);
  animation: floatGlow 12s ease-in-out infinite alternate;
}

#app-body::after {
  right: -18rem;
  bottom: -20rem;
  background: radial-gradient(circle, hsl(187 100% 55% / 0.72), transparent 64%);
  animation: floatGlow 14s ease-in-out infinite alternate-reverse;
}

#page-shell {
  isolation: isolate;
}

#grid-overlay {
  mask-image: linear-gradient(to bottom, transparent, black 10%, black 86%, transparent);
  animation: gridDrift 24s linear infinite;
}

#grid-overlay::after {
  position: absolute;
  inset: 0;
  content: "";
  background: linear-gradient(180deg, transparent 0%, hsl(187 100% 55% / 0.08) 49%, transparent 50%);
  background-size: 100% 9px;
  mix-blend-mode: screen;
  opacity: 0.45;
  animation: scanline 7s linear infinite;
}

#app-header,
#app-footer,
#calculator-panel,
#status-orbital-card,
#control-panel,
#result-panel,
#primary-result-card,
#timeline-output,
#notification-modal-card,
[id^="metric-"],
[id^="detail-"],
[id^="insight-"] {
  position: relative;
  overflow: hidden;
}

#app-header::before,
#app-footer::before,
#calculator-panel::before,
#status-orbital-card::before,
#control-panel::before,
#result-panel::before,
#notification-modal-card::before,
[id^="insight-"]::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(135deg, hsl(0 0% 100% / 0.10), transparent 34%),
    radial-gradient(circle at 20% 0%, hsl(187 100% 55% / 0.16), transparent 36%),
    radial-gradient(circle at 100% 100%, hsl(310 100% 58% / 0.14), transparent 38%);
}

#app-header {
  box-shadow: 0 1px 0 hsl(187 100% 55% / 0.24), 0 18px 60px hsl(224 70% 2% / 0.42);
}

#primary-navigation,
#main-content,
#footer-content {
  min-width: 0;
}

#brand-link {
  border-radius: 1.25rem;
  transition: transform 180ms ease, filter 180ms ease;
}

#brand-link:hover {
  transform: translateY(-1px);
  filter: drop-shadow(0 0 18px hsl(187 100% 55% / 0.42));
}

#brand-mark {
  position: relative;
  background:
    linear-gradient(145deg, hsl(252 58% 10%), hsl(246 42% 18%)),
    radial-gradient(circle at 30% 20%, hsl(187 100% 55% / 0.5), transparent 40%);
  text-shadow: 0 0 12px hsl(187 100% 55% / 0.82);
  animation: pulseMark 2.8s ease-in-out infinite;
}

#brand-mark::after {
  position: absolute;
  inset: -5px;
  z-index: -1;
  content: "";
  border-radius: 1.15rem;
  background: conic-gradient(from 180deg, var(--cyan-400), var(--pink-500), var(--indigo-500), var(--cyan-400));
  opacity: 0.28;
  filter: blur(10px);
}

#brand-text .font-display,
#hero-title,
#calculator-title,
#result-panel-title,
#primary-result-value {
  text-shadow: 0 0 22px hsl(252 100% 88% / 0.2);
}

#hero-section {
  animation: fadeUp 680ms ease both;
}

#hero-eyebrow,
#calculator-kicker,
#result-panel-kicker {
  text-shadow: 0 0 18px currentColor;
}

#hero-title {
  letter-spacing: -0.045em;
  background: linear-gradient(100deg, var(--text) 0%, var(--cyan-300) 34%, var(--pink-400) 68%, var(--text) 100%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: titleSheen 7s ease-in-out infinite;
}

#hero-description {
  text-wrap: pretty;
}

#status-orbital-card,
#calculator-panel {
  box-shadow: var(--shadow-panel);
}

#status-orbital-card::after {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  width: 8rem;
  height: 8rem;
  pointer-events: none;
  content: "";
  border: 1px solid hsl(187 100% 55% / 0.22);
  border-radius: 999px;
  background:
    radial-gradient(circle, transparent 38%, hsl(187 100% 55% / 0.13) 39%, transparent 41%),
    conic-gradient(from 0deg, transparent, hsl(187 100% 55% / 0.44), transparent, hsl(310 100% 58% / 0.35), transparent);
  opacity: 0.75;
  animation: orbit 14s linear infinite;
}

#status-live-indicator {
  box-shadow: 0 0 18px hsl(69 100% 52% / 0.62);
  animation: livePulse 1.8s ease-in-out infinite;
}

[id^="metric-"],
[id^="detail-"],
#primary-result-card,
#timeline-output {
  box-shadow: inset 0 1px 0 hsl(0 0% 100% / 0.06), 0 12px 34px hsl(224 70% 2% / 0.32);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

[id^="metric-"]:hover,
[id^="detail-"]:hover,
[id^="insight-"]:hover {
  transform: translateY(-3px);
  border-color: hsl(187 100% 62% / 0.72);
  box-shadow: var(--shadow-blue);
}

#calculator-panel {
  animation: fadeUp 760ms ease both;
}

#calculator-panel::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  border-radius: inherit;
  background:
    linear-gradient(90deg, transparent, hsl(187 100% 55% / 0.12), transparent),
    linear-gradient(180deg, transparent 0%, hsl(310 100% 58% / 0.08) 100%);
  opacity: 0.62;
  mask-image: linear-gradient(to bottom, black, transparent 72%);
}

#control-panel,
#result-panel {
  min-width: 0;
  box-shadow: inset 0 1px 0 hsl(0 0% 100% / 0.07);
}

#mode-tabs button,
#header-actions a,
#header-actions button,
#hero-cta-group a,
#calculator-quick-actions button,
form button[type="submit"],
#notification-modal-close-button,
#footer-links a {
  position: relative;
  min-width: 0;
  overflow: hidden;
  outline: none;
  transform: translateZ(0);
  box-shadow: inset 0 1px 0 hsl(0 0% 100% / 0.14), 0 10px 24px hsl(224 70% 2% / 0.34);
  transition:
    transform 170ms ease,
    box-shadow 170ms ease,
    border-color 170ms ease,
    background-color 170ms ease,
    color 170ms ease,
    filter 170ms ease;
}

#mode-tabs button::before,
#header-actions a::before,
#header-actions button::before,
#hero-cta-group a::before,
#calculator-quick-actions button::before,
form button[type="submit"]::before,
#notification-modal-close-button::before,
#footer-links a::before {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background: linear-gradient(120deg, transparent 0%, hsl(0 0% 100% / 0.22) 42%, transparent 64%);
  transform: translateX(-120%);
  transition: transform 520ms ease;
}

#mode-tabs button:hover::before,
#header-actions a:hover::before,
#header-actions button:hover::before,
#hero-cta-group a:hover::before,
#calculator-quick-actions button:hover::before,
form button[type="submit"]:hover::before,
#notification-modal-close-button:hover::before,
#footer-links a:hover::before {
  transform: translateX(120%);
}

#mode-tabs button:hover,
#header-actions a:hover,
#header-actions button:hover,
#hero-cta-group a:hover,
#calculator-quick-actions button:hover,
form button[type="submit"]:hover,
#notification-modal-close-button:hover,
#footer-links a:hover {
  transform: translateY(-2px);
  filter: saturate(1.12);
}

#mode-tabs button:active,
#header-actions a:active,
#header-actions button:active,
#hero-cta-group a:active,
#calculator-quick-actions button:active,
form button[type="submit"]:active,
#notification-modal-close-button:active,
#footer-links a:active {
  transform: translateY(0) scale(0.98);
}

button.bg-cyber-blue,
a.bg-cyber-blue,
form button[type="submit"],
#copy-results-button,
#notification-modal-close-button,
#start-calculating-link {
  background: linear-gradient(135deg, hsl(187 100% 48%), hsl(184 100% 62%)) !important;
  color: hsl(224 47% 6%) !important;
  border-color: hsl(184 100% 66%) !important;
  text-shadow: none;
}

button.bg-cyber-blue:hover,
a.bg-cyber-blue:hover,
form button[type="submit"]:hover,
#copy-results-button:hover,
#notification-modal-close-button:hover,
#start-calculating-link:hover {
  background: linear-gradient(135deg, hsl(69 100% 52%), hsl(158 82% 58%)) !important;
  color: hsl(224 47% 6%) !important;
  box-shadow: 0 0 26px hsl(69 100% 52% / 0.38), 0 14px 34px hsl(224 70% 2% / 0.48);
}

button.bg-cyber-panel,
a.bg-cyber-panel,
button.bg-cyber-void,
#learn-more-link,
#reset-all-button,
#theme-toggle-button,
#features-link {
  background: linear-gradient(135deg, hsl(252 58% 10% / 0.96), hsl(246 42% 18% / 0.96)) !important;
  color: var(--text) !important;
}

button.bg-cyber-panel:hover,
a.bg-cyber-panel:hover,
button.bg-cyber-void:hover,
#learn-more-link:hover,
#reset-all-button:hover,
#theme-toggle-button:hover,
#features-link:hover {
  background: linear-gradient(135deg, hsl(310 100% 42%), hsl(255 92% 46%)) !important;
  color: white !important;
  border-color: hsl(310 100% 70%) !important;
}

#mode-tabs button[aria-selected="true"] {
  background: linear-gradient(135deg, hsl(187 100% 48%), hsl(158 82% 52%)) !important;
  color: hsl(224 47% 6%) !important;
  border-color: hsl(184 100% 68%) !important;
  box-shadow: 0 0 28px hsl(187 100% 55% / 0.42), inset 0 1px 0 hsl(0 0% 100% / 0.24);
}

input,
select,
textarea {
  min-width: 0;
  color-scheme: dark;
  box-shadow: inset 0 1px 0 hsl(0 0% 100% / 0.06), 0 8px 24px hsl(224 70% 2% / 0.24);
}

input:hover,
select:hover,
textarea:hover {
  border-color: hsl(187 100% 62% / 0.95) !important;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
a:focus-visible {
  outline: none !important;
  box-shadow: var(--focus), 0 0 24px hsl(69 100% 52% / 0.18) !important;
}

input::placeholder,
textarea::placeholder {
  color: hsl(248 36% 78% / 0.72) !important;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  border-radius: 999px;
  background-color: hsl(187 100% 55% / 0.95);
  padding: 0.25rem;
  filter: invert(1) hue-rotate(130deg) saturate(1.8);
}

input[type="checkbox"] {
  accent-color: var(--pink-500);
}

fieldset {
  background: linear-gradient(135deg, hsl(252 58% 10% / 0.72), hsl(246 42% 18% / 0.42));
}

legend {
  max-width: 100%;
}

#primary-result-card {
  background:
    linear-gradient(135deg, hsl(252 58% 10% / 0.9), hsl(246 42% 18% / 0.8)),
    radial-gradient(circle at 100% 0%, hsl(310 100% 58% / 0.2), transparent 38%);
}

#primary-result-value {
  line-height: 1.05;
}

#result-status-badge {
  box-shadow: 0 0 18px hsl(310 100% 58% / 0.26);
}

#timeline-output-list {
  padding-left: 1.25rem;
}

#timeline-output-list li::marker {
  color: var(--cyan-400);
}

#insights-section {
  animation: fadeUp 840ms ease both;
}

[id^="insight-"] {
  min-width: 0;
  box-shadow: var(--shadow-panel);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}

#insight-business-card {
  box-shadow: 0 0 24px hsl(69 100% 52% / 0.16), 0 18px 48px hsl(224 70% 2% / 0.44);
}

#app-footer {
  box-shadow: 0 -1px 0 hsl(187 100% 55% / 0.22), 0 -18px 60px hsl(224 70% 2% / 0.32);
}

#notification-modal {
  z-index: 9999 !important;
}

#notification-modal:not(.hidden) {
  display: flex;
  animation: modalBackdropIn 180ms ease both;
}

#notification-modal-card {
  max-height: calc(100vh - 3rem);
  overflow: auto;
  box-shadow: 0 0 46px hsl(310 100% 58% / 0.42), 0 28px 80px hsl(224 70% 2% / 0.78);
  animation: modalCardIn 260ms cubic-bezier(0.2, 0.9, 0.2, 1.12) both;
}

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

.is-loading::after,
[aria-busy="true"]::after {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 1.25rem;
  height: 1.25rem;
  content: "";
  border: 2px solid hsl(187 100% 55% / 0.28);
  border-top-color: var(--acid);
  border-radius: 999px;
  transform: translate(-50%, -50%);
  animation: spin 780ms linear infinite;
}

@media (max-width: 640px) {
  #hero-title {
    letter-spacing: -0.035em;
  }

  #brand-text .tracking-\[0\.22em\],
  #brand-text .tracking-\[0\.28em\],
  #hero-eyebrow,
  #calculator-kicker,
  #result-panel-kicker {
    letter-spacing: 0.14em !important;
  }

  #mode-tabs button,
  #header-actions a,
  #header-actions button,
  #hero-cta-group a,
  #calculator-quick-actions button,
  form button[type="submit"] {
    width: 100%;
  }

  #header-actions,
  #calculator-quick-actions {
    width: 100%;
  }

  #primary-result-value {
    font-size: clamp(2.25rem, 13vw, 3.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 fadeUp {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes titleSheen {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

@keyframes gridDrift {
  from {
    background-position: 0 0, 0 0;
  }
  to {
    background-position: 42px 84px, 84px 42px;
  }
}

@keyframes scanline {
  from {
    transform: translateY(-10%);
  }
  to {
    transform: translateY(10%);
  }
}

@keyframes floatGlow {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(4rem, 2rem, 0) scale(1.08);
  }
}

@keyframes pulseMark {
  0%,
  100% {
    box-shadow: 0 0 18px hsl(310 100% 58% / 0.36), inset 0 0 18px hsl(187 100% 55% / 0.08);
  }
  50% {
    box-shadow: 0 0 30px hsl(187 100% 55% / 0.48), inset 0 0 24px hsl(310 100% 58% / 0.12);
  }
}

@keyframes livePulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.04);
    opacity: 0.82;
  }
}

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

@keyframes spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes modalBackdropIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalCardIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}