:root {
  --bg: #0b0f14;
  --panel: rgba(14, 19, 27, 0.82);
  --panel-strong: #111823;
  --line: rgba(181, 196, 214, 0.14);
  --text: #ecf2fb;
  --muted: #91a0b5;
  --accent: #7fd1b9;
  --accent-soft: rgba(127, 209, 185, 0.12);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  height: 100%;
  background:
    radial-gradient(circle at top left, rgba(127, 209, 185, 0.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(72, 122, 255, 0.12), transparent 24%),
    linear-gradient(180deg, #090d12 0%, #0d1219 100%);
}

body {
  margin: 0;
  padding: 40px 0 24px;
  height: 100%;
  min-height: 100vh;
  overflow: hidden;
  font-family: "SF Mono", "Cascadia Code", "Fira Code", monospace;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(127, 209, 185, 0.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(72, 122, 255, 0.12), transparent 24%),
    linear-gradient(180deg, #090d12 0%, #0d1219 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: linear-gradient(rgba(236, 242, 251, 0.04) 1px, transparent 1px);
  background-size: 100% 36px;
  opacity: 0.35;
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  height: calc(100vh - 64px);
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "identity about"
    "identity chat";
  gap: 20px;
  align-items: stretch;
}

.panel {
  min-height: 0;
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  overflow: hidden;
  animation: panel-in 520ms ease both;
}

.panel-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.panel-bar p {
  margin: 0 0 0 4px;
  font-size: 0.82rem;
  color: var(--muted);
}

.identity .panel-bar {
  padding-top: 8px;
  padding-bottom: 8px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #536174;
}

.identity {
  grid-area: identity;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

.identity-content,
.notes,
.about-content,
.composer,
.messages {
  padding: 22px;
}

.identity-content {
  display: grid;
  gap: 0;
  padding: 18px;
}

.portrait {
  width: 100%;
  height: clamp(380px, 48vh, 560px);
  object-fit: cover;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #151d29;
}

.eyebrow,
.label,
.message-role,
.hint {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--muted);
}

.eyebrow:empty {
  display: none;
}

.bio:empty {
  display: none;
}

.intro h1 {
  margin: 8px 0;
  line-height: 1;
  font-weight: 600;
}

.intro h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
}

.role {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: clamp(0.82rem, 1.4vw, 1rem);
  line-height: 1.4;
}

.location {
  margin: 0 0 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

.bio,
.notes p,
.about-content p,
.message p,
textarea,
button,
a,
li,
span {
  line-height: 1.65;
}

.notes {
  display: grid;
  gap: 14px;
  border-top: 1px solid var(--line);
  overflow: visible;
  padding: 18px;
}

.label {
  margin: 0 0 10px;
}

.contact-list {
  display: grid;
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.contact-list li {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

a {
  color: var(--text);
  text-decoration-color: rgba(127, 209, 185, 0.35);
  text-underline-offset: 3px;
}

.chat {
  grid-area: chat;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) min-content;
  height: 100%;
  overflow: hidden;
}

.messages {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px 16px;
  min-height: 0;
  min-width: 0;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: transparent;
}

.messages::-webkit-scrollbar {
  width: 10px;
}

.messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}

.messages::-webkit-scrollbar-thumb {
  background: rgba(127, 209, 185, 0.28);
  border-radius: 999px;
  border: 2px solid rgba(12, 18, 26, 0.9);
}

.about {
  grid-area: about;
  min-height: 0;
  overflow: hidden;
}

.about-content {
  border-top: 1px solid var(--line);
}

.about-content {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  padding-bottom: 12px;
  overflow: auto;
}


.about-content p {
  margin: 0;
  max-width: none;
}

.motto {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-decoration-color: rgba(127, 209, 185, 0.9);
  text-underline-offset: 4px;
}

.message {
  max-width: min(86%, 780px);
  width: fit-content;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 18px 18px 18px 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0)),
    var(--panel-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  animation: message-in 260ms ease both;
}

.message.user {
  justify-self: end;
  border-radius: 18px 18px 8px 18px;
  background:
    linear-gradient(180deg, rgba(127, 209, 185, 0.16), rgba(127, 209, 185, 0.08)),
    var(--accent-soft);
  border-color: rgba(127, 209, 185, 0.22);
}

.message-role {
  margin: 0 0 6px;
  font-size: 0.64rem;
}

.message p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.message a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.composer {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  padding: 8px 10px;
}

.composer-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(181, 196, 214, 0.12);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015)),
    rgba(8, 13, 20, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

textarea {
  width: 100%;
  resize: none;
  min-height: 22px;
  max-height: 240px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  line-height: 1.3;
}

textarea:focus,
button:focus {
  outline: 2px solid rgba(127, 209, 185, 0.24);
  outline-offset: 2px;
}

button {
  border: 0;
  border-radius: 999px;
  min-width: 78px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 600;
  color: #091019;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(127, 209, 185, 0.18);
}

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

.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: 920px) {
  body {
    height: auto;
    overflow: auto;
    padding: 24px 0 20px;
  }

  .shell {
    height: auto;
    min-height: auto;
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    grid-template-areas:
      "identity"
      "about"
      "chat";
  }

  .chat {
    min-height: 640px;
  }

  .composer-shell {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes message-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel,
  .message {
    animation: none;
  }
}
