:root {
  --bg-cream: #f4f1e7;
  --bg-sage: #e7efe6;
  --bg-sky: #e3e9f1;
  --ink-strong: #142b22;
  --ink: #234338;
  --ink-soft: #577166;
  --line: rgba(36, 67, 56, 0.18);
  --line-strong: rgba(36, 67, 56, 0.3);
  --glass: rgba(255, 255, 255, 0.62);
  --panel: rgba(255, 255, 255, 0.78);
  --panel-2: rgba(255, 255, 255, 0.54);
  --accent: #2f7d5c;
  --accent-strong: #205f45;
  --accent-warm: #bf8541;
  --accent-soft: rgba(47, 125, 92, 0.15);
  --user-bg: linear-gradient(160deg, #d9f0df 0%, #e7f5eb 100%);
  --ai-bg: linear-gradient(170deg, #ffffff 0%, #f6faf8 100%);
  --shadow-lg: 0 18px 40px rgba(20, 43, 34, 0.12);
  --shadow-md: 0 10px 24px rgba(20, 43, 34, 0.1);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
}

* {
  box-sizing: border-box;
}

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

body {
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink-strong);
  background:
    radial-gradient(1200px 700px at -12% -20%, rgba(47, 125, 92, 0.24), transparent 68%),
    radial-gradient(900px 560px at 112% -10%, rgba(191, 133, 65, 0.18), transparent 70%),
    linear-gradient(148deg, var(--bg-cream), var(--bg-sage) 52%, var(--bg-sky));
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.24;
  background-image: repeating-linear-gradient(120deg,
      rgba(20, 43, 34, 0.03) 0,
      rgba(20, 43, 34, 0.03) 1px,
      transparent 1px,
      transparent 16px);
}

a {
  color: inherit;
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1180px;
  margin: 18px auto;
  min-height: calc(100dvh - 36px);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--glass);
  box-shadow: var(--shadow-lg);
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  overflow: hidden;
  backdrop-filter: blur(12px) saturate(120%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.55));
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: "Noto Serif SC", serif;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  box-shadow: 0 8px 16px rgba(47, 125, 92, 0.28);
}

.brand-copy {
  min-width: 0;
}

.brand-title {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.2px;
  font-size: 16px;
  color: var(--ink-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.55);
  white-space: nowrap;
}

.status-badge.ok {
  color: var(--accent-strong);
  border-color: rgba(47, 125, 92, 0.35);
  background: rgba(47, 125, 92, 0.12);
}

.status-badge.down {
  color: #8f4b1f;
  border-color: rgba(191, 133, 65, 0.45);
  background: rgba(191, 133, 65, 0.14);
}

.top-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.top-btn:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.86);
}

.quick-strip {
  border-bottom: 1px solid var(--line);
  padding: 12px 20px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.48), rgba(255, 255, 255, 0.28));
}

.quick-card {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  min-height: 78px;
}

.quick-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-strong);
}

.quick-title {
  display: block;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 3px;
}

.quick-sub {
  display: block;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-soft);
}

.workspace {
  overflow-y: auto;
  padding: 18px 18px 140px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.welcome {
  width: min(920px, 100%);
  margin: 2px auto 0;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: clamp(18px, 3.2vw, 32px);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(250, 253, 251, 0.72));
  box-shadow: var(--shadow-md);
  animation: welcomeIn .55s ease both;
}

@keyframes welcomeIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

.hero-title {
  margin: 8px 0 0;
  font-family: "Noto Serif SC", serif;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.22;
  white-space: pre-line;
  color: var(--ink-strong);
}

.hero-sub {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.75;
  max-width: 740px;
}

.guide-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.guide-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.74);
  padding: 12px 12px 13px;
}

.guide-card h3 {
  margin: 0;
  font-size: 14px;
  color: var(--ink-strong);
}

.guide-card p {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 1.58;
}

.example-row {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.example-label {
  font-size: 12px;
  color: var(--ink-soft);
  margin-right: 4px;
}

.pill {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.pill.small {
  padding: 7px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
}

.pill.small:hover {
  background: #fff;
  border-color: var(--line-strong);
}

.chat {
  width: min(920px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg-row {
  display: flex;
  align-items: flex-start;
  animation: msgIn .24s ease;
}

@keyframes msgIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.msg-row.user {
  justify-content: flex-end;
}

.msg-row.ai {
  justify-content: flex-start;
}

.bubble {
  max-width: min(84%, 760px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: 0 8px 18px rgba(20, 43, 34, 0.06);
}

.msg-row.user .bubble {
  background: var(--user-bg);
  border-color: rgba(47, 125, 92, 0.28);
  border-top-right-radius: 8px;
}

.msg-row.ai .bubble {
  background: var(--ai-bg);
  border-top-left-radius: 8px;
}

.role {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 6px;
}

.content {
  font-size: 14px;
  line-height: 1.72;
  color: var(--ink-strong);
  word-break: break-word;
}

.content p {
  margin: 0 0 8px;
}

.content p:last-child {
  margin-bottom: 0;
}

.content h1,
.content h2,
.content h3,
.content h4 {
  margin: 14px 0 8px;
  line-height: 1.3;
  color: var(--accent-strong);
}

.content h1 {
  font-size: 18px;
}

.content h2 {
  font-size: 16px;
}

.content h3 {
  font-size: 15px;
}

.content ul,
.content ol {
  margin: 6px 0 10px;
  padding-left: 18px;
}

.content li {
  margin-bottom: 2px;
}

.content strong {
  color: #1e5f44;
}

.content code {
  font-family: "JetBrains Mono", "SF Mono", Menlo, monospace;
  font-size: 12px;
  background: rgba(47, 125, 92, 0.11);
  color: #1a5a41;
  padding: 1px 5px;
  border-radius: 6px;
}

.content pre {
  margin: 10px 0;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #f3f8f6;
  overflow-x: auto;
}

.content pre code {
  background: transparent;
  padding: 0;
}

.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 13px;
}

.content th,
.content td {
  border: 1px solid var(--line);
  padding: 7px 8px;
  text-align: left;
}

.content th {
  background: rgba(47, 125, 92, 0.12);
}

.content blockquote {
  margin: 10px 0;
  border-left: 3px solid var(--accent);
  background: rgba(47, 125, 92, 0.08);
  border-radius: 0 10px 10px 0;
  padding: 6px 10px;
  color: var(--ink);
}

.loading {
  width: min(920px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 13px;
  padding: 4px 2px;
}

.dots {
  display: flex;
  gap: 4px;
}

.dots span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  animation: dotJump 1.2s infinite ease-in-out;
}

.dots span:nth-child(2) {
  animation-delay: 0.18s;
}

.dots span:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes dotJump {

  0%,
  70%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }

  35% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.composer {
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.62));
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}

.composer-shell {
  width: min(920px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 8px;
}

.input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

#input {
  width: 100%;
  min-height: 50px;
  max-height: 170px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--ink-strong);
  font: inherit;
  font-size: 15px;
  line-height: 1.56;
  padding: 12px 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#input:focus {
  border-color: rgba(47, 125, 92, 0.5);
  box-shadow: 0 0 0 4px rgba(47, 125, 92, 0.12);
}

#input::placeholder {
  color: #769184;
}

.send-btn {
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong));
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.16s ease, filter 0.16s ease;
  flex-shrink: 0;
}

.send-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.send-btn:active {
  transform: translateY(0);
}

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

.composer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hint {
  color: var(--ink-soft);
  font-size: 12px;
}

.meta-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.msg-count {
  font-size: 12px;
  color: var(--ink-soft);
  margin-right: 4px;
}

.meta-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  color: var(--ink);
  border-radius: var(--radius-pill);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  cursor: pointer;
}

.meta-btn:hover {
  border-color: var(--line-strong);
  background: #fff;
}

@media (max-width: 1100px) {
  .quick-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 760px) {
  .app-shell {
    margin: 0;
    min-height: 100dvh;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .topbar {
    padding: 12px;
    gap: 10px;
    flex-wrap: wrap;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
    font-size: 18px;
  }

  .brand-title {
    font-size: 14px;
  }

  .brand-sub {
    display: none;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .status-badge {
    margin-right: auto;
  }

  .quick-strip {
    padding: 10px 12px;
    display: flex;
    overflow-x: auto;
    gap: 8px;
    scroll-snap-type: x mandatory;
  }

  .quick-card {
    min-width: 220px;
    scroll-snap-align: start;
    min-height: 84px;
  }

  .workspace {
    padding: 12px 12px 130px;
  }

  .welcome {
    border-radius: 18px;
  }

  .hero-sub {
    font-size: 13px;
  }

  .example-label {
    width: 100%;
    margin-bottom: -2px;
  }

  .bubble {
    max-width: 100%;
    padding: 11px 12px;
  }

  .content {
    font-size: 13px;
  }

  .composer {
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  }

  #input {
    font-size: 16px;
  }

  .hint {
    display: none;
  }

  .msg-count {
    display: none;
  }
}
