:root {
  --green: #00ff41;
  --green-dim: #0a8f2a;
  --bg: #000000;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  background: var(--bg);
  overflow: hidden;
}

body {
  font-family: "Courier New", Courier, ui-monospace, monospace;
  color: var(--green);
  position: relative;
}

/* Subtle matrix rain sits behind everything */
#matrix {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.12;
  z-index: 0;
  pointer-events: none;
}

.topbar {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 2;
  padding: 1.5rem 2rem;
}

.login {
  color: var(--green);
  text-decoration: none;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  font-size: 0.95rem;
  letter-spacing: 0.15em;
  text-transform: lowercase;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--green-dim);
  border-radius: 2px;
  background: rgba(0, 255, 65, 0.03);
  transition: all 0.2s ease;
  text-shadow: 0 0 6px rgba(0, 255, 65, 0.6);
}

.login:hover,
.login:focus-visible {
  background: rgba(0, 255, 65, 0.12);
  border-color: var(--green);
  box-shadow: 0 0 14px rgba(0, 255, 65, 0.4);
  outline: none;
}

.stage {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
  padding: 1rem;
}

.tagline {
  font-size: clamp(2rem, 8vw, 4.5rem);
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  text-shadow:
    0 0 10px rgba(0, 255, 65, 0.7),
    0 0 22px rgba(0, 255, 65, 0.35);
}

.cursor {
  display: inline-block;
  margin-left: 0.05em;
  animation: blink 1.05s steps(1) infinite;
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  50.01%,
  100% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor {
    animation: none;
  }
  #matrix {
    display: none;
  }
}

/* ---------- App / chat layout ---------- */
body.app {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100vh;
}

body.app .topbar {
  position: static;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.4rem;
  border-bottom: 1px solid var(--green-dim);
  flex: 0 0 auto;
}

.brand {
  font-size: 0.95rem;
  letter-spacing: 0.14em;
  text-shadow: 0 0 6px rgba(0, 255, 65, 0.5);
}

.role-tag {
  opacity: 0.6;
  margin-left: 0.6rem;
}
.role-tag:not(:empty)::before {
  content: "/ ";
}

.role-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 2rem;
  min-width: min(360px, 80vw);
}

.role-btn {
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  color: var(--green);
  background: rgba(0, 255, 65, 0.04);
  border: 1px solid var(--green-dim);
  border-radius: 2px;
  padding: 0.85rem 1.2rem;
  font-size: 1rem;
  letter-spacing: 0.05em;
  text-align: left;
  transition: all 0.15s ease;
}
.role-btn:hover,
.role-btn:focus-visible {
  background: rgba(0, 255, 65, 0.12);
  border-color: var(--green);
  box-shadow: 0 0 14px rgba(0, 255, 65, 0.3);
  outline: none;
}

.chatwrap {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 1.5rem clamp(1rem, 6vw, 6rem);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.bubble {
  max-width: 680px;
  white-space: pre-wrap;
  word-wrap: break-word;
  line-height: 1.55;
  font-size: 0.98rem;
  padding: 0.85rem 1.1rem;
  border-radius: 4px;
}
.bubble.bot {
  align-self: flex-start;
  border: 1px solid var(--green-dim);
  background: rgba(0, 255, 65, 0.04);
  color: var(--green);
  text-shadow: 0 0 4px rgba(0, 255, 65, 0.35);
}
.bubble.me {
  align-self: flex-end;
  background: rgba(0, 255, 65, 0.14);
  color: #d6ffe0;
}
.bubble.thinking::after {
  content: "▋";
  animation: blink 1.05s steps(1) infinite;
}

.composer {
  flex: 0 0 auto;
  display: flex;
  gap: 0.6rem;
  padding: 1rem clamp(1rem, 6vw, 6rem);
  border-top: 1px solid var(--green-dim);
}
.composer input {
  flex: 1 1 auto;
  font-family: inherit;
  font-size: 1rem;
  color: var(--green);
  background: #000;
  border: 1px solid var(--green-dim);
  border-radius: 2px;
  padding: 0.75rem 1rem;
  outline: none;
}
.composer input:focus {
  border-color: var(--green);
  box-shadow: 0 0 10px rgba(0, 255, 65, 0.25);
}
.composer input:disabled {
  opacity: 0.5;
}
.composer button {
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  color: var(--green);
  background: rgba(0, 255, 65, 0.06);
  border: 1px solid var(--green-dim);
  border-radius: 2px;
  padding: 0 1.3rem;
  font-size: 0.95rem;
  letter-spacing: 0.1em;
  text-transform: lowercase;
  transition: all 0.15s ease;
}
.composer button:hover {
  background: rgba(0, 255, 65, 0.14);
  border-color: var(--green);
}
