:root {
  --bg: #020914;
  --panel: rgba(7, 18, 33, 0.86);
  --panel-strong: rgba(10, 29, 51, 0.94);
  --line: rgba(116, 206, 255, 0.24);
  --line-strong: rgba(116, 206, 255, 0.48);
  --text: #eef8ff;
  --muted: #99b7ca;
  --dim: #668295;
  --cyan: #28d5ff;
  --blue: #2787ff;
  --green: #50e6a6;
  --amber: #ffd36d;
  --danger: #ff7b7b;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  overflow: hidden;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font-family:
    "Microsoft YaHei UI",
    "Microsoft YaHei",
    "PingFang SC",
    "Noto Sans CJK SC",
    Arial,
    sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  position: relative;
  display: grid;
  height: 100vh;
  min-height: 100vh;
  grid-template-columns: minmax(0, 1fr) minmax(440px, 34vw);
  overflow: hidden;
  background:
    radial-gradient(circle at 66% 18%, rgba(37, 154, 255, 0.16), transparent 28%),
    #020914;
}

.factory-stage {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  padding: 34px clamp(28px, 4vw, 64px);
}

.factory-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
  filter: saturate(1.06) contrast(1.04);
}

.factory-vignette {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(2, 9, 20, 0.05), rgba(2, 9, 20, 0.2) 42%, rgba(2, 9, 20, 0.88) 88%),
    linear-gradient(180deg, rgba(2, 9, 20, 0.56), transparent 22%, rgba(2, 9, 20, 0.62) 100%);
  pointer-events: none;
}

.topbar,
.status-strip,
.line-map {
  position: relative;
  z-index: 1;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: 760px;
}

.brand-mark {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(80, 230, 166, 0.42);
  border-radius: var(--radius);
  color: var(--green);
  background: rgba(3, 19, 27, 0.62);
  box-shadow: 0 0 32px rgba(40, 213, 255, 0.16);
}

.brand-mark svg {
  width: 31px;
  height: 31px;
}

.brand-mark path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.brand p,
.brand h1,
.panel-header h2,
.assistant-state {
  margin: 0;
}

.brand p {
  color: #a6def9;
  font-size: 15px;
  line-height: 1.6;
}

.brand h1 {
  margin-top: 2px;
  color: #f7fdff;
  font-size: clamp(30px, 4vw, 58px);
  line-height: 1.04;
  font-weight: 760;
}

.action-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 128px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(40, 213, 255, 0.46);
  border-radius: var(--radius);
  color: #eefdff;
  background: rgba(5, 31, 52, 0.68);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.action-button:hover {
  transform: translateY(-1px);
  border-color: rgba(80, 230, 166, 0.68);
  background: rgba(7, 44, 70, 0.82);
}

.action-button svg,
.composer button svg {
  width: 19px;
  height: 19px;
}

.action-button path {
  fill: currentColor;
}

.status-strip {
  display: grid;
  width: min(760px, 82%);
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: clamp(44px, 11vh, 120px);
}

.metric {
  min-height: 92px;
  padding: 18px;
  border: 1px solid rgba(116, 206, 255, 0.22);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(8, 28, 49, 0.8), rgba(4, 14, 26, 0.56));
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.metric strong {
  display: block;
  margin-top: 8px;
  color: #ffffff;
  font-size: clamp(20px, 2vw, 30px);
  line-height: 1.15;
}

.line-map {
  display: flex;
  align-items: center;
  width: min(850px, 88%);
  gap: 10px;
  margin-top: clamp(46px, 21vh, 230px);
  color: #d8f7ff;
}

.line-map span {
  display: grid;
  min-width: 92px;
  min-height: 38px;
  place-items: center;
  border: 1px solid rgba(40, 213, 255, 0.35);
  border-radius: var(--radius);
  background: rgba(4, 20, 36, 0.72);
  font-size: 14px;
  white-space: nowrap;
}

.line-map i {
  position: relative;
  height: 1px;
  min-width: 34px;
  flex: 1;
  background: linear-gradient(90deg, rgba(40, 213, 255, 0.18), rgba(40, 213, 255, 0.74));
}

.line-map i::after {
  position: absolute;
  top: 50%;
  right: -2px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 18px var(--cyan);
  content: "";
  transform: translateY(-50%);
}

.assistant-panel {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  gap: 18px;
  padding: 28px;
  border-left: 1px solid rgba(116, 206, 255, 0.22);
  background:
    linear-gradient(180deg, rgba(7, 18, 33, 0.88), rgba(4, 10, 21, 0.94)),
    rgba(5, 13, 24, 0.88);
  box-shadow: -30px 0 90px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(18px);
}

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

.assistant-state {
  display: inline-flex;
  align-items: center;
  color: var(--green);
  font-size: 13px;
  line-height: 1.5;
}

.assistant-state::before {
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 14px currentColor;
  content: "";
}

.panel-header h2 {
  margin-top: 3px;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 720;
}

.signal {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 28px;
  color: var(--cyan);
}

.signal span {
  display: block;
  width: 5px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 12px currentColor;
}

.signal span:nth-child(1) {
  height: 10px;
  opacity: 0.62;
}

.signal span:nth-child(2) {
  height: 17px;
  opacity: 0.82;
}

.signal span:nth-child(3) {
  height: 24px;
}

.question-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.question-card {
  width: 100%;
  min-height: 80px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #d9f5ff;
  background: rgba(10, 30, 52, 0.58);
  text-align: left;
  line-height: 1.5;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.question-card span {
  display: block;
  margin-bottom: 5px;
  color: var(--cyan);
  font-size: 12px;
  font-weight: 700;
}

.question-card:hover,
.question-card.active {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: rgba(16, 50, 83, 0.76);
}

.chat-window {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding: 2px 2px 10px;
  scrollbar-color: rgba(40, 213, 255, 0.34) transparent;
}

.empty-state {
  display: grid;
  min-height: 170px;
  place-content: center;
  gap: 8px;
  border: 1px dashed rgba(116, 206, 255, 0.28);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(5, 19, 34, 0.42);
  text-align: center;
}

.empty-state strong {
  color: #eefdff;
  font-size: 19px;
  line-height: 1.35;
}

.empty-state span {
  font-size: 14px;
  line-height: 1.5;
}

.message {
  display: grid;
  gap: 8px;
  animation: rise 220ms ease both;
}

.message.user {
  justify-items: end;
}

.bubble {
  max-width: 92%;
  border-radius: var(--radius);
  line-height: 1.6;
}

.user .bubble {
  padding: 11px 14px;
  color: #061525;
  background: linear-gradient(135deg, #55e5ff, #6bffbb);
  box-shadow: 0 12px 28px rgba(40, 213, 255, 0.18);
}

.bot .bubble {
  width: 100%;
  padding: 0;
}

.answer-card {
  overflow: hidden;
  border: 1px solid rgba(116, 206, 255, 0.23);
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.26);
}

.answer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid rgba(116, 206, 255, 0.16);
  background: linear-gradient(90deg, rgba(39, 135, 255, 0.18), transparent);
}

.answer-top h3 {
  margin: 4px 0 0;
  font-size: 20px;
  line-height: 1.25;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border: 1px solid rgba(80, 230, 166, 0.35);
  border-radius: 999px;
  color: #a6ffd5;
  background: rgba(22, 111, 78, 0.16);
  font-size: 12px;
}

.severity {
  min-width: 72px;
  color: var(--amber);
  font-size: 13px;
  text-align: right;
}

.answer-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.answer-section h4 {
  margin: 0 0 9px;
  color: #bcdef0;
  font-size: 14px;
  line-height: 1.35;
}

.reason-list,
.step-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.reason-list li,
.step-list li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  min-height: 32px;
  color: #dceef7;
  font-size: 14px;
  line-height: 1.5;
}

.reason-list b,
.step-list b {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  color: #061525;
  background: var(--cyan);
  font-size: 12px;
  line-height: 1;
}

.step-list b {
  background: var(--green);
}

.source-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 11px;
  border: 1px solid rgba(255, 211, 109, 0.2);
  border-radius: var(--radius);
  color: #ffe6a6;
  background: rgba(255, 211, 109, 0.08);
  font-size: 13px;
  line-height: 1.45;
}

.typing {
  display: inline-flex;
  width: 66px;
  gap: 5px;
  padding: 12px 14px;
  border: 1px solid rgba(116, 206, 255, 0.18);
  border-radius: var(--radius);
  background: rgba(10, 29, 51, 0.82);
}

.typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  animation: blink 900ms ease-in-out infinite;
}

.typing i:nth-child(2) {
  animation-delay: 120ms;
}

.typing i:nth-child(3) {
  animation-delay: 240ms;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 10px;
  padding-top: 2px;
}

.composer input {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(116, 206, 255, 0.28);
  border-radius: var(--radius);
  outline: none;
  color: var(--text);
  background: rgba(3, 16, 30, 0.82);
  padding: 0 14px;
  font-size: 14px;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.composer input:focus {
  border-color: rgba(40, 213, 255, 0.68);
  box-shadow: 0 0 0 3px rgba(40, 213, 255, 0.12);
}

.composer input::placeholder {
  color: #6f8da1;
}

.composer button {
  display: grid;
  width: 46px;
  min-height: 46px;
  place-items: center;
  border: 1px solid rgba(80, 230, 166, 0.4);
  border-radius: var(--radius);
  color: #071526;
  background: linear-gradient(135deg, #40dcff, #5cf2af);
}

.composer button path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

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

@keyframes blink {
  0%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  50% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (max-width: 1160px) {
  .app-shell {
    height: auto;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  body {
    overflow-y: auto;
  }

  .factory-stage {
    min-height: 46vh;
  }

  .factory-vignette {
    background:
      linear-gradient(180deg, rgba(2, 9, 20, 0.72), rgba(2, 9, 20, 0.28) 48%, rgba(2, 9, 20, 0.94) 100%),
      linear-gradient(90deg, rgba(2, 9, 20, 0.08), rgba(2, 9, 20, 0.4));
  }

  .status-strip,
  .line-map {
    width: 100%;
    margin-top: 34px;
  }

  .assistant-panel {
    min-height: 54vh;
    border-top: 1px solid rgba(116, 206, 255, 0.2);
    border-left: 0;
  }
}

@media (max-width: 720px) {
  .factory-stage,
  .assistant-panel {
    padding: 20px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
  }

  .action-button {
    justify-content: center;
    width: 100%;
  }

  .status-strip {
    grid-template-columns: 1fr;
  }

  .line-map {
    display: grid;
    grid-template-columns: 1fr;
  }

  .line-map i {
    width: 1px;
    min-width: 1px;
    height: 22px;
    justify-self: center;
    background: linear-gradient(180deg, rgba(40, 213, 255, 0.18), rgba(40, 213, 255, 0.74));
  }

  .line-map i::after {
    top: auto;
    right: 50%;
    bottom: -2px;
    transform: translateX(50%);
  }

  .panel-header h2 {
    font-size: 26px;
  }

  .question-card {
    min-height: 74px;
  }

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

  .severity {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
