:root {
  color-scheme: dark;
  --bg: #101114;
  --surface: #191b20;
  --surface-2: #22262c;
  --line: #343943;
  --text: #f4f2ea;
  --muted: #b7b3a7;
  --accent: #3fbf9f;
  --accent-2: #f3b84d;
  --danger: #ff7b7b;
  --radius: 8px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(63, 191, 159, 0.16), transparent 30rem),
    linear-gradient(135deg, #101114 0%, #181315 42%, #14211f 100%);
  color: var(--text);
}

button,
textarea,
select {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  padding: 24px;
  background: rgba(16, 17, 20, 0.78);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(63, 191, 159, 0.45);
  border-radius: 50%;
  background: #142b27;
  color: var(--accent);
  font-weight: 900;
  box-shadow: 0 0 40px rgba(63, 191, 159, 0.2);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 1.4rem;
  letter-spacing: 0;
}

.brand p,
.eyebrow,
.status-panel li,
.select-label {
  color: var(--muted);
}

.modes {
  display: grid;
  gap: 8px;
  margin-bottom: 24px;
}

.mode-button,
.ghost-button,
.send-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.mode-button {
  width: 100%;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 0 14px;
}

.mode-button:hover,
.ghost-button:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.mode-button.active {
  background: rgba(63, 191, 159, 0.14);
  border-color: rgba(63, 191, 159, 0.7);
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(25, 27, 32, 0.8);
  padding: 16px;
}

.pro-panel {
  margin-top: 12px;
}

.pro-panel p {
  color: var(--muted);
  line-height: 1.45;
}

.pro-panel a {
  color: var(--accent);
  overflow-wrap: anywhere;
}

.panel h2 {
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.panel ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
}

.workspace {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
  max-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}

.topbar h2 {
  margin-top: 4px;
  font-size: clamp(1.3rem, 2vw, 2rem);
  letter-spacing: 0;
}

.ghost-button {
  padding: 0 16px;
  background: transparent;
  color: var(--text);
}

.conversation {
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: auto;
  padding: 24px;
}

.message {
  display: grid;
  grid-template-columns: 36px minmax(0, 780px);
  gap: 12px;
  align-items: start;
}

.message.user {
  grid-template-columns: minmax(0, 780px) 36px;
  justify-content: end;
}

.message.user .avatar {
  order: 2;
  background: #322316;
  color: var(--accent-2);
}

.avatar {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: #142b27;
  color: var(--accent);
  font-weight: 800;
}

.bubble {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(25, 27, 32, 0.9);
  padding: 14px;
  box-shadow: var(--shadow);
  overflow-wrap: anywhere;
}

.message.user .bubble {
  background: rgba(34, 38, 44, 0.9);
}

.bubble pre {
  overflow: auto;
  padding: 12px;
  border-radius: var(--radius);
  background: #0c0d10;
}

.bubble img,
.bubble video {
  display: block;
  width: min(100%, 520px);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.composer {
  display: grid;
  gap: 12px;
  padding: 20px 24px 24px;
  border-top: 1px solid var(--line);
  background: rgba(16, 17, 20, 0.78);
}

textarea,
select {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  padding: 14px;
  line-height: 1.5;
}

textarea:focus,
select:focus {
  outline: 2px solid rgba(63, 191, 159, 0.34);
  border-color: var(--accent);
}

.composer-actions {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
}

.select-label {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
}

select {
  height: 42px;
  padding: 0 12px;
}

.send-button {
  min-width: 120px;
  border-color: transparent;
  background: var(--accent);
  color: #071411;
  font-weight: 800;
}

.send-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.error {
  color: var(--danger);
}

@media (max-width: 800px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    max-height: none;
  }

  .topbar,
  .composer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .conversation {
    min-height: 48vh;
  }
}
