:root {
  --outer-black: #030304;
  --deep-bg: radial-gradient(circle at 45% 55%, #0c0e14, #010203 75%, #000000);
  --aether-gold: #d6b26d;
  --aether-teal: #6dd6bf;
  --aether-rose: #ff7eb9;
  --aether-orange-dark: #cc5c00;
  --text-cream: #f1e9dd;
  --soft-glow: rgba(214, 178, 109, 0.25);
  --panel-gradient: linear-gradient(160deg, rgba(10, 15, 25, 0.96), rgba(22, 28, 38, 0.88));
  --panel-border: rgba(214, 178, 109, 0.2);
  --footer-gradient: linear-gradient(135deg, rgba(173, 122, 255, 0.08), rgba(109, 214, 191, 0.08), rgba(0, 0, 0, 0.9));
  --panel-radius: 1.25rem;
  --footer-height: 58px;
  --footer-safe-area: env(safe-area-inset-bottom, 0px);
  --footer-total-height: calc(var(--footer-height) + var(--footer-safe-area));
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--outer-black);
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text-cream);
}

body {
  position: relative;
}

.frame-wrapper {
  position: relative;
  width: 100vw;
  height: 100vh;
  border-radius: 1.5rem;
  background: var(--deep-bg);
  overflow: hidden;
  box-shadow: 0 0 3rem rgba(109, 214, 191, 0.25);
}

.neon-pattern {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(45deg, rgba(109, 214, 191, 0.05) 0 1px, transparent 1px 25px), repeating-linear-gradient(-45deg, rgba(255, 126, 185, 0.05) 0 1px, transparent 1px 25px);
  background-size: 50px 50px;
  animation: movePattern 20s linear infinite, hueShift 30s infinite alternate;
  opacity: 0.85;
  z-index: 0;
}

@keyframes movePattern {
  0% {
    background-position: 0 0, 0 0;
  }
  100% {
    background-position: 200px 200px, -200px -200px;
  }
}

@keyframes hueShift {
  0% {
    filter: hue-rotate(0deg);
  }
  100% {
    filter: hue-rotate(360deg);
  }
}

.visual-stage {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  pointer-events: none;
}

.diamond-stack {
  position: relative;
  width: clamp(180px, 25vw, 240px);
  height: clamp(180px, 25vw, 240px);
  display: grid;
  place-items: center;
  opacity: 0.45;
}

.diamond {
  position: absolute;
  width: 40%;
  aspect-ratio: 1 / 1;
  border-radius: 16%;
  transform: rotate(45deg);
  border: 2px solid transparent;
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.25);
  animation: pulse 2.6s ease-in-out infinite;
}

.diamond-1 {
  width: 52%;
  border-color: rgba(0, 240, 255, 0.6);
  animation-delay: 0s;
}

.diamond-2 {
  width: 68%;
  border-color: rgba(156, 214, 255, 0.55);
  animation-delay: 0.3s;
}

.diamond-3 {
  width: 84%;
  border-color: rgba(247, 126, 194, 0.55);
  animation-delay: 0.6s;
}

.diamond-4 {
  width: 100%;
  border-color: rgba(255, 179, 71, 0.55);
  animation-delay: 0.9s;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.35;
    transform: rotate(45deg) scale(0.92);
  }
  50% {
    opacity: 1;
    transform: rotate(45deg) scale(1.05);
  }
}

.diamond-track {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  animation: rotate 10s linear infinite;
}

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

.diamond-track span {
  position: absolute;
  width: 18%;
  aspect-ratio: 1 / 1;
  border-radius: 18%;
  border: 2px solid rgba(0, 240, 255, 0.7);
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.45);
  transform: rotate(45deg);
  animation: blink 1.8s ease-in-out infinite;
}

.diamond-track span:nth-child(1) {
  top: 2%;
  animation-delay: 0s;
}

.diamond-track span:nth-child(2) {
  right: 2%;
  animation-delay: 0.3s;
}

.diamond-track span:nth-child(3) {
  bottom: 2%;
  animation-delay: 0.6s;
}

.diamond-track span:nth-child(4) {
  left: 2%;
  animation-delay: 0.9s;
}

@keyframes blink {
  0%,
  100% {
    opacity: 0.2;
    transform: rotate(45deg) scale(0.85);
  }
  50% {
    opacity: 1;
    transform: rotate(45deg) scale(1.05);
  }
}

.preload-status {
  position: absolute;
  bottom: calc(65px + 2.75rem);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: rgba(3, 3, 4, 0.85);
  border: 1px solid rgba(214, 178, 109, 0.35);
  box-shadow: 0 0 20px rgba(214, 178, 109, 0.15);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--text-cream);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 30;
}

.preload-status.is-active {
  opacity: 1;
}

.preload-status.is-error {
  border-color: rgba(255, 126, 185, 0.55);
  color: var(--aether-rose);
  box-shadow: 0 0 20px rgba(255, 126, 185, 0.2);
}

.cass-app {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  right: 1.5rem;
  bottom: calc(var(--footer-total-height) + 2rem);
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.cass-app > * {
  grid-area: 1 / 1 / 2 / 2;
}

.cass-intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2.5rem 2rem;
  gap: 1rem;
  color: rgba(241, 233, 221, 0.85);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.cass-intro__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 32rem;
}

.cass-intro__title {
  margin: 0;
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--aether-gold);
}

.cass-intro__body {
  margin: 0;
  max-width: 38ch;
  font-size: 0.95rem;
  line-height: 1.6;
  color: rgba(241, 233, 221, 0.7);
}

.cass-app[data-state='idle'] .cass-intro {
  opacity: 1;
  pointer-events: auto;
}

.cass-panels {
  flex: 1;
  display: flex;
  gap: 1.25rem;
  transition: all 0.4s ease;
  min-height: 0;
  opacity: 1;
  height: 100%;
}

.cass-app[data-state='idle'] .cass-panels {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
}

.cass-app:not([data-state='idle']) .cass-panels {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.cass-panels[data-orientation='horizontal'] {
  flex-direction: row;
}

.cass-panels[data-orientation='vertical'] {
  flex-direction: column;
}

.cass-panels[data-orientation='vertical'][data-expanded='false'] .cass-panel {
  flex: 1 1 50%;
}

.cass-panels[data-flip='flipped'][data-orientation='horizontal'] {
  flex-direction: row-reverse;
}

.cass-panels[data-flip='flipped'][data-orientation='vertical'] {
  flex-direction: column-reverse;
}

.cass-panels[data-expanded='true'] .results-panel {
  display: none;
}

.cass-panels[data-expanded='true'] .entity-panel {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
}

.cass-panels[data-view='results-only'] .entity-panel {
  display: none;
}

.cass-panels[data-view='results-only'] .results-panel {
  flex: 1 1 100%;
  min-width: 0;
}

.cass-panels[data-view='reports'] .results-panel,
.cass-panels[data-view='reports'] .entity-panel {
  display: none;
}

.cass-panels[data-view='reports'] .reports-panel {
  display: flex;
  flex: 1 1 100%;
  min-width: 0;
}

.cass-panel {
  flex: 1;
  background: var(--panel-gradient);
  border: 1px solid var(--panel-border);
  border-radius: var(--panel-radius);
  backdrop-filter: blur(18px);
  box-shadow: 0 20px 45px rgba(3, 3, 4, 0.45);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.results-panel {
  min-width: clamp(280px, 32%, 460px);
}

.reports-panel {
  display: none;
  padding: clamp(1.25rem, 4vw, 3rem);
  position: relative;
  overflow: hidden;
  align-items: stretch;
  flex-direction: column;
}

.reports-panel > * {
  width: 100%;
}

.reports-panel[hidden] {
  display: none !important;
}

.panel-placeholder {
  margin: auto;
  text-align: center;
  padding: 2rem;
  color: rgba(241, 233, 221, 0.7);
  max-width: 24rem;
  line-height: 1.5;
}

.panel-placeholder h2 {
  margin-bottom: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.footer-bar {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2rem);
  height: var(--footer-height);
  background: var(--footer-gradient);
  border-top: 1px solid rgba(109, 214, 191, 0.25);
  border-radius: 0 0 1.5rem 1.5rem;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 0 1.4rem;
  padding-bottom: var(--footer-safe-area);
  gap: 0.9rem;
  flex-wrap: nowrap;
  box-shadow: 0 -3px 15px rgba(109, 214, 191, 0.15);
  backdrop-filter: blur(12px);
  z-index: 9;
  font-size: 0.8rem;
}

.footer-search {
  display: flex;
  align-items: center;
  flex: 0 1 320px;
  position: relative;
  min-width: 0;
}

.footer-search__status {
  position: absolute;
  right: 2.9rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--aether-teal);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.footer-search__status.is-visible {
  opacity: 1;
}

.footer-search__status.is-empty {
  color: rgba(109, 214, 191, 0.55);
}

.footer-search input[type='search'] {
  width: 100%;
  padding: 0.55rem 1rem;
  padding-right: 6rem;
  border-radius: 999px;
  border: 1px solid rgba(109, 214, 191, 0.35);
  background: rgba(3, 3, 4, 0.6);
  color: var(--text-cream);
  font-size: 0.9rem;
  transition: border 0.3s ease, box-shadow 0.3s ease;
}

.footer-search__clear {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 126, 185, 0.7);
  background: rgba(255, 126, 185, 0.08);
  color: var(--aether-rose);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.footer-search__clear:hover,
.footer-search__clear:focus-visible {
  background: rgba(255, 126, 185, 0.2);
  border-color: var(--aether-rose);
  outline: none;
}

.footer-search__clear[disabled] {
  opacity: 0.3;
  cursor: default;
  pointer-events: none;
}

.footer-search input[type='search']:focus {
  outline: none;
  border-color: var(--aether-teal);
  box-shadow: 0 0 0 2px rgba(109, 214, 191, 0.25);
}

.footer-action {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(214, 178, 109, 0.45);
  color: var(--text-cream);
  padding: 0.55rem 1rem;
  border-radius: 999px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: all 0.3s ease;
}

.footer-action:hover,
.footer-action:focus-visible {
  color: var(--aether-rose);
  border-color: var(--aether-rose);
  box-shadow: 0 0 12px rgba(255, 126, 185, 0.35);
}

.footer-action[aria-pressed='true'] {
  background: rgba(214, 178, 109, 0.18);
  border-color: var(--aether-gold);
  color: var(--aether-gold);
}

.hamburger {
  margin-left: auto;
  width: 28px;
  height: 20px;
  position: relative;
  cursor: pointer;
  transition: all 0.4s ease;
}

.hamburger span {
  background: linear-gradient(90deg, var(--aether-rose), var(--aether-teal));
  position: absolute;
  height: 3px;
  width: 100%;
  border-radius: 2px;
  left: 0;
  transition: all 0.4s ease;
  box-shadow: 0 0 8px var(--aether-rose);
}

.hamburger span:nth-child(1) {
  top: 0;
}

.hamburger span:nth-child(2) {
  top: 8px;
}

.hamburger span:nth-child(3) {
  top: 16px;
}

.hamburger.active span {
  background: var(--aether-rose);
  box-shadow: 0 0 12px var(--aether-rose);
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg);
  top: 8px;
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg);
  top: 8px;
}

.top-nav {
  position: absolute;
  bottom: 65px;
  right: 0.5rem;
  display: flex;
  flex-direction: row;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  border-radius: 20px;
  background: linear-gradient(160deg, rgba(60, 30, 5, 0.95), rgba(20, 10, 0, 0.9));
  border: 2px solid var(--aether-orange-dark);
  box-shadow: 0 0 15px rgba(255, 123, 0, 0.35);
  backdrop-filter: blur(12px);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.4s ease;
  pointer-events: none;
  z-index: 15;
}

.top-nav.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.top-nav button,
.top-nav a {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(109, 214, 191, 0.25);
  color: var(--text-cream);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  letter-spacing: 0.05em;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.top-nav button:hover,
.top-nav button:focus-visible,
.top-nav a:hover,
.top-nav a:focus-visible {
  color: var(--aether-rose);
  text-shadow: 0 0 6px var(--aether-teal);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1100px) {
  .cass-app {
    top: 1rem;
    left: 1rem;
    right: 1rem;
    bottom: 5.5rem;
  }

  .results-panel {
    min-width: clamp(240px, 45%, 420px);
  }
}

@media (max-width: 820px) {
  .cass-panels {
    gap: 0.9rem;
  }

  .cass-panel {
    border-radius: 1rem;
  }

  .footer-bar {
    gap: 0.6rem;
    padding: 0 1rem;
  }

  .footer-search {
    flex: 1 1 auto;
  }

  .footer-search input[type='search'] {
    font-size: 0.85rem;
  }

  .footer-search__status {
    right: 2.35rem;
    font-size: 0.72rem;
  }

  .footer-search__clear {
    width: 1.55rem;
    height: 1.55rem;
    right: 0.6rem;
  }
}

@media (max-width: 640px) {
  .cass-app {
    top: 0.75rem;
    left: 0.75rem;
    right: 0.75rem;
    bottom: 5.5rem;
  }

  .cass-intro {
    padding: 2rem 1.5rem;
    gap: 0.75rem;
  }

  .cass-intro__title {
    font-size: 1.4rem;
  }

  .footer-bar {
    flex-wrap: nowrap;
    height: var(--footer-height);
    padding: 0 0.85rem;
    gap: 0.5rem;
  }

  .footer-search__status {
    position: absolute;
    right: 2.1rem;
    top: 50%;
    transform: translateY(-50%);
    order: initial;
    width: auto;
    text-align: right;
    margin-top: 0;
  }

  .footer-search {
    flex: 1 1 auto;
    min-width: 0;
  }

  .footer-search input[type='search'] {
    padding-right: 5.25rem;
  }

  .footer-search__clear {
    right: 0.4rem;
  }

  .hamburger {
    margin-left: auto;
  }
}
