:root {
  --bg: #f3efe4;
  --panel: rgba(255, 252, 245, 0.86);
  --panel-strong: #fffaf0;
  --ink: #1f1d1a;
  --muted: #6e665d;
  --line: rgba(65, 53, 39, 0.12);
  --accent: #dd6b20;
  --accent-dark: #9c4221;
  --good: #2f855a;
  --bad: #c53030;
  --shadow: 0 24px 60px rgba(73, 52, 24, 0.14);
  --font-ui: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 214, 153, 0.7), transparent 28%),
    radial-gradient(circle at top right, rgba(255, 247, 214, 0.9), transparent 32%),
    linear-gradient(135deg, #efe5d3 0%, #f8f4eb 55%, #e7dcc6 100%);
}

.app-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 32px auto;
  display: grid;
  gap: 18px;
}

.hero,
.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  padding: 28px 30px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: var(--accent-dark);
}

.hero h1,
.panel h2 {
  margin: 0;
  font-weight: 700;
}

.hero-copy,
.panel-head p,
.attachment,
.status-label {
  color: var(--muted);
}

.status-card {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 190px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--line);
}

.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: var(--bad);
  box-shadow: 0 0 0 8px rgba(197, 48, 48, 0.12);
}

.status-dot.active {
  background: var(--good);
  box-shadow: 0 0 0 8px rgba(47, 133, 90, 0.12);
}

.panel {
  padding: 22px;
}

.panel-chat {
  min-height: 460px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 360px;
}

.bubble {
  max-width: min(78%, 680px);
  padding: 14px 16px;
  border-radius: 20px;
  line-height: 1.55;
  white-space: pre-wrap;
  animation: rise 180ms ease-out;
}

.bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, #f6ad55, #dd6b20);
  color: white;
  border-bottom-right-radius: 6px;
}

.bubble.ai {
  align-self: flex-start;
  background: var(--panel-strong);
  border: 1px solid rgba(156, 66, 33, 0.12);
  border-bottom-left-radius: 6px;
}

.bubble.system {
  align-self: center;
  text-align: center;
  background: rgba(255, 255, 255, 0.55);
  color: var(--muted);
  font-size: 14px;
}

.panel-controls {
  display: grid;
  gap: 14px;
}

.control-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.toggles {
  gap: 22px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
}

input[type="text"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  font: inherit;
  background: rgba(255, 255, 255, 0.8);
}

.btn,
.upload-btn span {
  border: none;
  border-radius: 16px;
  padding: 12px 18px;
  font: inherit;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease, background 140ms ease;
}

.btn:hover,
.upload-btn span:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, #dd6b20, #c05621);
  color: white;
}

.btn-secondary,
.upload-btn span {
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-danger {
  background: #fff1f0;
  color: #9b2c2c;
  border: 1px solid rgba(197, 48, 48, 0.18);
}

.upload-btn input {
  display: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 800px) {
  .app-shell {
    width: min(100vw - 18px, 100%);
    margin: 10px auto 20px;
  }

  .hero {
    padding: 20px;
    flex-direction: column;
  }

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

  .bubble {
    max-width: 100%;
  }
}
