:root {
  color-scheme: dark;
  --bg: #101216;
  --panel: #181c23;
  --panel-strong: #202632;
  --text: #f4f7fb;
  --muted: #a8b3c4;
  --line: #313948;
  --accent: #5fe0b8;
  --accent-2: #ffcf5a;
  --danger: #ff7777;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 22% 12%, rgba(95, 224, 184, 0.18), transparent 30%),
    radial-gradient(circle at 84% 18%, rgba(255, 207, 90, 0.12), transparent 26%),
    linear-gradient(135deg, #11141a 0%, #171b22 45%, #0f1115 100%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100vw - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
}

.chat-panel,
.memory-panel {
  background: rgba(24, 28, 35, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow);
}

.chat-panel {
  min-height: calc(100vh - 32px);
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.memory-panel {
  min-height: calc(100vh - 32px);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.top-bar,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.top-bar {
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 0.95;
}

h2 {
  font-size: 1.55rem;
}

.status-pill {
  min-width: 118px;
  padding: 10px 12px;
  border: 1px solid rgba(95, 224, 184, 0.38);
  background: rgba(95, 224, 184, 0.12);
  color: #d9fff4;
  text-align: center;
  font-weight: 800;
}

.chat-window {
  min-height: 360px;
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  width: min(78%, 720px);
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  line-height: 1.45;
  white-space: pre-line;
}

.message .speaker {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.message.bot {
  align-self: flex-start;
  background: var(--panel-strong);
}

.message.user {
  align-self: flex-end;
  background: rgba(95, 224, 184, 0.14);
  border-color: rgba(95, 224, 184, 0.35);
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px;
  padding: 18px;
  border-top: 1px solid var(--line);
}

.composer input {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--text);
  background: #11151c;
  outline: none;
}

.composer input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(95, 224, 184, 0.16);
}

.composer button,
.tips button,
.ghost-button {
  min-height: 42px;
  border: 1px solid transparent;
  color: #07110e;
  background: var(--accent);
  font-weight: 900;
}

.composer button {
  min-width: 92px;
}

.voice-button {
  min-width: 74px;
  color: var(--text);
  background: #27303d;
  border-color: #3b4657;
}

.voice-button[aria-pressed="true"] {
  color: #07110e;
  background: var(--accent-2);
  border-color: var(--accent-2);
}

.voice-status {
  min-height: 20px;
  margin: -8px 18px 14px;
  color: var(--muted);
  font-size: 0.86rem;
}

.ghost-button {
  min-width: 74px;
  color: var(--danger);
  background: rgba(255, 119, 119, 0.12);
  border-color: rgba(255, 119, 119, 0.34);
}

.memory-list {
  min-height: 180px;
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.memory-list li {
  padding: 12px;
  border: 1px solid var(--line);
  background: #121720;
  color: #e7edf7;
  line-height: 1.35;
}

.empty-memory {
  color: var(--muted);
}

.tips {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 9px;
}

.tips p {
  margin: 0 0 2px;
  color: var(--muted);
  font-weight: 800;
}

.tips button {
  width: 100%;
  padding: 10px 12px;
  color: var(--text);
  background: #27303d;
  border-color: #3b4657;
  text-align: left;
}

@media (max-width: 820px) {
  .app-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    grid-template-columns: 1fr;
    gap: 0;
  }

  .chat-panel,
  .memory-panel {
    min-height: auto;
    border-left: 0;
    border-right: 0;
  }

  .chat-panel {
    min-height: 70vh;
  }

  .message {
    width: 100%;
  }

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

  .composer input {
    grid-column: 1 / -1;
  }

  .top-bar {
    align-items: flex-start;
    flex-direction: column;
  }
}
