:root {
  color-scheme: light dark;
  font-family: 'Inter', 'Segoe UI', Roboto, sans-serif;
  background-color: #070c15;
  color: #e2e8f0;
}

body {
  margin: 0;
  min-height: 100vh;
  display: block;
  background: #000;
  padding: 0;
}

#hero {
  position: relative;
  min-height: 100vh;
  background: #000;
}


#errorOverlay {
  display: grid;
  place-items: center;
  background: #000;
}

#errorOverlay .panel {
  opacity: 0;
  transform: scale(0.94);
}

#errorOverlay .panel-body {
  color: #ffd54a;
}

#titleWrap h1 {
  color: #ffd54a;
  text-shadow: 0 0 24px rgba(255, 213, 74, 0.32);
}

#titleWrap .cta {
  background: linear-gradient(90deg, #ffd54a, #ffb400);
  color: #111;
  box-shadow: 0 10px 28px rgba(255, 213, 74, 0.35);
}

* {
  box-sizing: border-box;
}

.products-panel,
.chat-panel {
  display: flex;
  flex-direction: column;
  background: rgba(13, 20, 36, 0.94);
}

.products-panel {
  padding: 1.6rem clamp(1.2rem, 2.6vw, 2rem);
  border-right: 1px solid rgba(148, 163, 184, 0.16);
  overflow: hidden;
}

.section-header {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.section-header h2 {
  margin: 0;
  font-size: clamp(1.15rem, 1.5vw, 1.35rem);
  font-weight: 600;
}

.section-header p {
  margin: 0;
  color: rgba(226, 232, 240, 0.68);
  font-size: clamp(0.85rem, 1vw, 0.95rem);
}

.product-list {
  flex: 1;
  margin-top: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  padding-right: 0.4rem;
  scrollbar-width: thin;
}

.product-row {
  display: grid;
  grid-template-columns: 96px 1fr auto;
  gap: 1.2rem;
  align-items: center;
  padding: 1rem 1.25rem;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(22, 32, 52, 0.92);
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.product-row:hover {
  border-color: rgba(96, 165, 250, 0.7);
  transform: translateY(-2px);
}

.product-thumbnail {
  width: 96px;
  height: 96px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.45), rgba(14, 116, 144, 0.65));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(226, 232, 240, 0.85);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
}

.product-details {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-width: 0;
}

.product-head {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
}

.product-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  color: #f8fafc;
}

.product-description {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: rgba(226, 232, 240, 0.78);
}

.product-meta {
  display: flex;
  flex-direction: column;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: rgba(148, 163, 184, 0.85);
}

.product-price {
  font-weight: 600;
  font-size: 1.08rem;
  color: #38bdf8;
}

.product-actions {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.product-actions button {
  border: none;
  border-radius: 14px;
  padding: 0.6rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.product-actions button.add {
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: #07111f;
}

.product-actions button.compare {
  background: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

.product-actions button:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.chat-panel {
  padding: 1.6rem clamp(1.2rem, 2.6vw, 2rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-header {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.chat-header h2 {
  margin: 0;
  font-size: clamp(1.2rem, 1.6vw, 1.4rem);
  font-weight: 600;
}

.chat-header p {
  margin: 0;
  color: rgba(226, 232, 240, 0.65);
  font-size: clamp(0.85rem, 1vw, 0.92rem);
}

.chat-history {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  overflow-y: auto;
  padding-right: 0.4rem;
}

.chat-message {
  max-width: 96%;
  padding: 0.85rem 1rem;
  border-radius: 18px;
  line-height: 1.45;
  font-size: 0.96rem;
}

.chat-message.assistant {
  align-self: flex-start;
  background: rgba(30, 41, 59, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.25);
}

.chat-message.user {
  align-self: flex-end;
  background: rgba(96, 165, 250, 0.88);
  color: #0b1220;
}

.chat-input {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.8rem;
  background: rgba(30, 41, 59, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 18px;
  padding: 0.85rem;
}

.chat-input textarea {
  flex: 1;
  min-height: 74px;
  max-height: 160px;
  background: transparent;
  color: inherit;
  border: none;
  resize: none;
  font-family: inherit;
  font-size: 0.95rem;
}

.chat-input textarea:focus {
  outline: none;
}

.chat-input button {
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #f8fafc;
  font-weight: 600;
  padding: 0.7rem 1.2rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-input button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.3);
}

@media (max-width: 1080px) {
  .page-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }
  .products-panel,
  .chat-panel {
    border-right: none;
    padding: clamp(1rem, 4vw, 1.4rem);
  }
  .products-panel {
    border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  }
  .product-list {
    max-height: 360px;
  }
}

@media (max-width: 720px) {
  .product-row {
    grid-template-columns: 72px 1fr;
    grid-template-rows: auto auto;
  }
  .product-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    justify-content: flex-end;
  }
  .product-thumbnail {
    width: 72px;
    height: 72px;
  }
}

@media (max-width: 620px) {
  .chat-input {
    flex-direction: column;
    align-items: stretch;
  }
  .chat-input button {
    width: 100%;
  }
}

body.has-intro {
  overflow: hidden;
}

.intro {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at center, #0f172a 0%, #020617 54%, #000 100%);
  transition: opacity 0.6s ease;
}

.intro.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.intro__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(1rem, 3vw, 2rem);
  text-align: center;
}

.intro__bolt {
  position: relative;
  width: min(320px, 62vw);
  aspect-ratio: 1/1;
  opacity: 0.12;
  transform: scale(0.92);
  transition: opacity 0.22s ease, transform 0.22s ease;
  transform-origin: 50% 50%;
}

.intro__bolt-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.intro__bolt-glow {
  position: absolute;
  inset: -12%;
  background: radial-gradient(circle, rgba(255, 215, 0, 0.45), rgba(255, 170, 0, 0.05) 70%, transparent 100%);
  filter: blur(12px);
  opacity: 0.7;
  pointer-events: none;
}

.intro__bolt.is-glow .intro__bolt-glow {
  opacity: 1;
}

.intro__bolt.is-solid {
  opacity: 1;
  transform: scale(1);
}

.intro__bolt.is-visible {
  opacity: 1;
  transform: scale(1.02);
}

.intro__tagline {
  margin: 0;
  font-size: clamp(1.25rem, 2.6vw, 2.4rem);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #f8fafc;
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 1.1s ease, transform 1.1s ease;
}

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

.intro-sequence {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: #000;
  animation: introBaseFade 0.4s ease-out both;
}

.intro-sequence.is-hidden {
  animation: introExit 0.75s ease forwards;
}

.intro-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
}

.intro-stage.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.intro-stage--glitch {
  background: #004aad;
}

.intro-stage--glitch.is-active {
  animation: introHueShift 2.2s ease-in-out;
}

.intro-stage--glitch.is-glitch {
  filter: saturate(1.4) contrast(1.3);
}

.intro-stage--glitch.is-still {
  animation-play-state: paused;
}

.intro-noise {
  position: absolute;
  inset: -12%;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 2px, transparent 2px 6px),
              repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.16) 0 3px, transparent 3px 7px);
  mix-blend-mode: screen;
  opacity: 0.35;
  animation: introNoise 0.17s steps(4) infinite;
}

.intro-bars {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  padding: 2vh 0;
  pointer-events: none;
}

.intro-bars span {
  height: 6px;
  margin: 6px 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(15, 23, 42, 0), rgba(255, 255, 255, 0.8), rgba(15, 23, 42, 0));
  transform: scaleX(0);
  transform-origin: left;
  animation: introBarSweep 2.2s ease forwards;
}

.intro-bars span:nth-child(odd) { animation-delay: 0.18s; }
.intro-bars span:nth-child(even) { animation-delay: 0.32s; }
.intro-bars span:nth-child(3n) { animation-delay: 0.46s; }

.intro-flash {
  position: absolute;
  inset: -10%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, transparent 55%);
  opacity: 0;
  mix-blend-mode: screen;
  transition: opacity 0.15s ease;
}

.intro-flash.is-on {
  opacity: 1;
}

.intro-stage--solid {
  background: #000;
}

.solid-frame {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.solid-frame.is-visible {
  opacity: 1;
  transform: scale(1.02);
}

.solid-frame--a { background: #ff0048; }
.solid-frame--b { background: #00ffd5; }
.solid-frame--c { background: #1d0c68; }

.intro-stage--terminal {
  background: #02070d;
  display: grid;
  place-items: center;
}

.terminal-frame {
  position: relative;
  width: min(720px, 94vw);
  height: min(360px, 60vh);
  background: radial-gradient(circle at top, rgba(16, 24, 40, 0.95) 0%, rgba(6, 12, 20, 0.98) 65%);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(2, 8, 20, 0.65);
  overflow: hidden;
  padding: clamp(1rem, 3vw, 1.6rem);
}

.terminal-frame::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(255, 255, 255, 0.04), transparent 38%);
  pointer-events: none;
}

.terminal-scanline {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, transparent 0%, rgba(255, 255, 255, 0.03) 50%, transparent 100%);
  mix-blend-mode: screen;
  animation: terminalScan 4s linear infinite;
}

.terminal-content {
  position: relative;
  display: grid;
  grid-auto-rows: min-content;
  row-gap: 0.35rem;
  font-family: 'Fira Code', 'Cascadia Code', monospace;
  font-size: clamp(0.75rem, 1vw, 0.9rem);
  color: #38bdf8;
  overflow: hidden;
  height: 75%;
}

.terminal-line {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  white-space: nowrap;
}

.terminal-phrase {
  position: absolute;
  left: 50%;
  bottom: clamp(1.2rem, 3vw, 1.8rem);
  transform: translateX(-50%) translateY(16px);
  font-size: clamp(1.3rem, 1.8vw, 2rem);
  font-weight: 600;
  letter-spacing: 0.05em;
  color: #f8fafc;
  text-shadow: 0 6px 35px rgba(56, 189, 248, 0.52);
  opacity: 0;
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.terminal-phrase.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@keyframes introHueShift {
  0% { background-color: #004aad; }
  35% { background-color: #b3005a; }
  65% { background-color: #1d0c68; }
  100% { background-color: #003a8c; }
}

@keyframes introNoise {
  0% { transform: translate(0, 0); }
  25% { transform: translate(-2%, -1%); }
  50% { transform: translate(1%, 2%); }
  75% { transform: translate(-1%, 3%); }
  100% { transform: translate(2%, -2%); }
}

@keyframes introBarSweep {
  0% { transform: scaleX(0); opacity: 0; }
  10% { opacity: 1; }
  60% { transform: scaleX(1); opacity: 0.9; }
  100% { transform: scaleX(0.1); opacity: 0; }
}

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

@keyframes introExit {
  to {
    opacity: 0;
    pointer-events: none;
  }
}

@keyframes terminalScan {
  0% { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}

.page-shell {
  display: none;
}

body:not(.has-intro) .page-shell,
.page-shell.is-visible {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(360px, 44%) minmax(320px, 1fr);
  height: 100vh;
  width: 100vw;
  background: rgba(10, 16, 28, 0.82);
  backdrop-filter: blur(16px);
  gap: 1px;
  opacity: 1;
  pointer-events: auto;
}
