:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #1a1a1a);
  --hint: var(--tg-theme-hint-color, #8a8a8e);
  --card: var(--tg-theme-secondary-bg-color, #f1f3f5);
  --accent: var(--tg-theme-button-color, #2d7ff9);
  --accent-text: var(--tg-theme-button-text-color, #ffffff);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 16px;
  max-width: 640px;
  margin: 0 auto;
}

/* Главный экран */
.hero {
  text-align: center;
  padding: 24px 0 16px;
}
.hero-emoji {
  font-size: 44px;
}
.hero h1 {
  font-size: 26px;
  margin-top: 8px;
}
.hero p {
  color: var(--hint);
  margin-top: 4px;
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}
.card {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  background: var(--card);
  border: none;
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  color: inherit;
  transition: transform 0.08s;
}
.card:active {
  transform: scale(0.98);
}
.card-emoji {
  font-size: 30px;
}
.card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.card-name {
  font-size: 17px;
  font-weight: 600;
}
.card-tag {
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
}
.card-desc {
  font-size: 13px;
  color: var(--hint);
  margin-top: 2px;
}
.card-arrow {
  font-size: 24px;
  color: var(--hint);
}

/* Экран агента */
.agent-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 0 16px;
}
.agent-emoji {
  font-size: 34px;
}
.agent-head h2 {
  font-size: 20px;
}
.agent-head p {
  font-size: 14px;
  color: var(--hint);
  margin-top: 4px;
}

.composer {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#task {
  width: 100%;
  min-height: 90px;
  resize: vertical;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--card);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
}
.send-btn {
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 14px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.send-btn:disabled {
  opacity: 0.6;
}

#answer {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bubble {
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 15px;
  white-space: pre-wrap;
  line-height: 1.45;
}
.bubble.user {
  background: var(--accent);
  color: var(--accent-text);
  align-self: flex-end;
  max-width: 85%;
}
.bubble.agent {
  background: var(--card);
  align-self: flex-start;
  max-width: 95%;
}
.bubble.agent.loading {
  color: var(--hint);
}
.bubble.error {
  background: #ffe3e3;
  color: #c0392b;
}

/* История */
.history {
  margin-top: 28px;
}
.history h3 {
  font-size: 15px;
  color: var(--hint);
  margin-bottom: 10px;
}
.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hist-item {
  background: var(--card);
  border-radius: 12px;
  padding: 10px 12px;
}
.hist-task {
  font-size: 14px;
}
.hist-time {
  font-size: 11px;
  color: var(--hint);
  margin-top: 3px;
}
.muted {
  color: var(--hint);
  font-size: 14px;
}
