:root {
  color-scheme: light;
  --bg: #fff6fa;
  --panel: #ffffff;
  --panel-2: #ffe7f0;
  --text: #482032;
  --muted: #8d6676;
  --line: #f3cfdd;
  --accent: #f47aa7;
  --accent-2: #ffd1df;
  --accent-3: #b64a74;
  --danger: #c73658;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(780px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto auto 1fr auto auto;
  gap: 12px;
  padding: calc(env(safe-area-inset-top) + 18px) 16px calc(env(safe-area-inset-bottom) + 16px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-3);
  font-size: 12px;
  letter-spacing: 0;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.icon-btn,
.primary-btn,
.secondary-btn,
.send-btn {
  border: 1px solid transparent;
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
}

.icon-btn {
  width: 44px;
  background: var(--panel);
  color: var(--text);
  border-color: var(--line);
  font-size: 22px;
}

.status {
  min-height: 38px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffafd;
  color: var(--muted);
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(151, 74, 105, 0.08);
}

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

.messages {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 0;
}

.empty {
  margin: auto;
  color: var(--muted);
  text-align: center;
}

.message {
  max-width: min(84%, 560px);
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  line-height: 1.45;
  overflow-wrap: anywhere;
  box-shadow: 0 10px 24px rgba(151, 74, 105, 0.08);
}

.message.user {
  align-self: flex-end;
  background: #f47aa7;
  border-color: #f47aa7;
  color: #ffffff;
}

.message.assistant {
  align-self: flex-start;
  background: #ffffff;
}

.message.keepalive {
  border-color: #ffc1d6;
  background: #fff0f6;
}

.meta {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
}

.controls,
.composer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary-btn {
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(244, 122, 167, 0.26);
}

.secondary-btn {
  background: var(--panel);
  color: var(--text);
  border-color: var(--line);
}

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

.composer input {
  min-width: 0;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 0 12px;
  box-shadow: 0 8px 20px rgba(151, 74, 105, 0.08);
}

.send-btn {
  background: var(--accent-2);
  color: #68233e;
  font-weight: 700;
  padding: 0 18px;
}

@media (max-width: 560px) {
  .app-shell {
    padding-inline: 12px;
  }

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

  .message {
    max-width: 92%;
  }
}
