:root {
  --bg: #120c24;
  --bg-grid: rgba(66, 255, 191, 0.08);
  --panel: #1d1734;
  --panel-2: #2a2250;
  --panel-3: #100c1f;
  --line: #6df2c6;
  --line-soft: rgba(109, 242, 198, 0.28);
  --text: #ddfff1;
  --muted: #8adcc1;
  --brand: #ffbf47;
  --brand-strong: #ff8b3d;
  --user: #2f2a62;
  --assistant: #18142a;
  --success: #7dff88;
  --error: #ff7b8a;
  --shadow: 0 0 0 2px #08060f, 0 0 0 4px #4b3c87, 0 18px 40px rgba(0, 0, 0, 0.45);
}

html,
body {
  height: 100%;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Courier New", Courier, monospace;
  color: var(--text);
  background:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px),
    radial-gradient(circle at top, rgba(255, 191, 71, 0.14), transparent 30%),
    linear-gradient(180deg, #0a0814 0%, var(--bg) 100%);
  background-size: 24px 24px, 24px 24px, auto, auto;
  overflow: hidden;
}

.app-shell {
  height: 100vh;
  height: 100dvh;
  display: block;
  padding: 0;
}

.chat-card {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
  position: relative;
}

.chat-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0));
  mix-blend-mode: screen;
}

.hero {
  flex-shrink: 0;
  padding: 0;
  border-bottom: 2px solid var(--line);
  background: linear-gradient(180deg, #352c63 0%, #241d46 100%);
}

.hero-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(90deg, #5d4aa8 0%, #3f3277 100%);
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
}

.hero-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #f7d37a;
  border: 1px solid #2e244d;
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.45);
}

.hero-caption {
  margin-left: auto;
  font-size: 0.76rem;
  color: #f5e6a7;
  letter-spacing: 0.08em;
}

.eyebrow {
  margin: 16px 18px 8px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--brand);
}

h1 {
  margin: 0 18px;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.45);
}

.intro {
  margin: 12px 18px 18px;
  color: var(--muted);
  max-width: 40rem;
}

.chat-window {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 16px;
  background: linear-gradient(180deg, rgba(10, 8, 20, 0.78), rgba(20, 16, 34, 0.9));
  overflow: hidden;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px;
  border: 2px solid var(--line-soft);
  background: var(--panel-3);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.35);
}

.message {
  max-width: 88%;
  padding: 14px 16px;
  border-radius: 0;
  border: 2px solid var(--line-soft);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.message-system,
.message-assistant {
  background: var(--assistant);
}

.message-user {
  margin-left: auto;
  background: var(--user);
  border-color: rgba(255, 191, 71, 0.36);
}

.message-typing {
  width: fit-content;
  min-width: 92px;
}

.message-role {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand);
}

.message-content {
  margin: 0;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 20px;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 0;
  background: var(--brand);
  animation: typing-bounce 1s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes typing-bounce {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }

  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.status-banner {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 0;
  font-weight: 700;
  border: 2px solid currentColor;
}

.status-banner.success {
  background: rgba(125, 255, 136, 0.08);
  color: var(--success);
}

.status-banner.error {
  background: rgba(255, 123, 138, 0.08);
  color: var(--error);
}

.composer {
  flex-shrink: 0;
  z-index: 2;
  padding: 16px;
  border-top: 2px solid var(--line);
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 88px;
  border-radius: 0;
  border: 2px solid var(--line);
  padding: 14px 16px;
  font: inherit;
  color: var(--text);
  background: #090711;
}

textarea:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 191, 71, 0.35);
  border-color: var(--brand);
}

.composer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

button {
  border: 2px solid #ffe29c;
  border-radius: 0;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: linear-gradient(180deg, #ffcc52, #ff9f43);
  color: #24170b;
  cursor: pointer;
  box-shadow: inset -2px -2px 0 rgba(122, 66, 0, 0.32), inset 2px 2px 0 rgba(255, 244, 196, 0.8);
}

button:disabled {
  opacity: 0.65;
  cursor: wait;
}

.form-error {
  margin: 0;
  color: var(--error);
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.sr-only {
  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: 640px) {
  .app-shell {
    padding: 0;
  }

  .hero,
  .chat-window,
  .composer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .message {
    max-width: 94%;
  }

  .composer-row {
    align-items: flex-start;
    flex-direction: column;
  }

  button {
    width: 100%;
  }
}
