:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #eef2f8;
  color: #162033;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

button,
input,
textarea {
  font: inherit;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(380px, 520px) 330px;
  gap: 22px;
  min-height: 100vh;
  padding: 28px;
}

.stage,
.chat-shell,
.tester {
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 20px;
  background: white;
  box-shadow: 0 20px 60px rgba(30, 41, 59, 0.09);
}

.stage {
  position: relative;
  display: flex;
  align-items: end;
  min-height: 520px;
  padding: 36px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(15, 23, 42, 0.05), rgba(15, 23, 42, 0.78)),
    radial-gradient(circle at 25% 20%, #f6a66f 0, transparent 35%),
    radial-gradient(circle at 75% 38%, #7c8ee8 0, transparent 40%),
    #34415d;
  color: white;
}

.stage h1 {
  margin: 8px 0;
  font-size: clamp(36px, 5vw, 68px);
  line-height: 0.98;
}

.stage p:last-child {
  max-width: 560px;
  color: #d9e1ee;
}

.live-badge {
  position: absolute;
  top: 22px;
  left: 22px;
  padding: 7px 12px;
  border-radius: 999px;
  background: #ef4444;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.eyebrow {
  margin: 0;
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stage .eyebrow {
  color: #dbe5f4;
}

.chat-shell {
  display: flex;
  flex-direction: column;
  min-height: 620px;
  overflow: hidden;
}

.chat-shell header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  border-bottom: 1px solid #e8edf4;
}

.chat-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
}

.auto-toggle {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border-radius: 999px;
  background: #e8efff;
  color: #2447b8;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.auto-toggle input {
  width: auto;
  margin: 0;
}

.service-status {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
}

.service-status[data-state="success"] {
  color: #047857;
}

.service-status[data-state="working"] {
  color: #2563eb;
}

.service-status[data-state="review"],
.service-status[data-state="error"] {
  color: #b45309;
}

h2 {
  margin: 5px 0 0;
  font-size: 21px;
}

button {
  padding: 10px 14px;
  border: 0;
  border-radius: 10px;
  background: #315bea;
  color: white;
  cursor: pointer;
  font-weight: 700;
}

.chat-list {
  flex: 1;
  min-height: 400px;
  padding: 14px 22px;
  overflow-y: auto;
}

.live-chat-message {
  margin: 10px 0;
  padding: 12px 14px;
  border-radius: 13px;
  background: #f2f5fa;
  line-height: 1.45;
}

.user-name {
  margin-right: 8px;
  color: #315bea;
  font-weight: 800;
}

.message-text {
  color: #334155;
}

.live-chat-message.staff {
  margin-left: 28px;
  background: #e8efff;
}

.live-chat-message.staff .user-name {
  color: #0f766e;
}

.live-chat-message.system {
  margin-left: 28px;
  border: 1px dashed #f59e0b;
  background: #fffbeb;
  color: #92400e;
  font-size: 12px;
}

#chat-form {
  display: grid;
  grid-template-columns: 1fr minmax(126px, auto);
  gap: 10px;
  padding: 18px 22px;
  border-top: 1px solid #e8edf4;
}

.send-actions {
  display: grid;
  gap: 8px;
}

button.secondary {
  background: #e2e8f0;
  color: #334155;
}

textarea,
input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  resize: vertical;
}

.tester {
  align-self: start;
  padding: 22px;
}

.tester label {
  display: block;
  margin: 16px 0;
  color: #475569;
  font-size: 13px;
  font-weight: 700;
}

.tester input,
.tester textarea {
  margin-top: 6px;
}

.tester button {
  width: 100%;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

pre {
  min-height: 210px;
  margin: 16px 0 0;
  padding: 14px;
  overflow: auto;
  border-radius: 12px;
  background: #101827;
  color: #cfe0ff;
  font: 12px/1.5 Consolas, monospace;
  white-space: pre-wrap;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 1fr 1fr;
  }
  .tester {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .layout {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .stage {
    min-height: 380px;
    padding: 28px;
  }

  .tester {
    grid-column: auto;
  }

  .chat-shell header {
    align-items: flex-start;
    flex-direction: column;
  }

  .chat-controls {
    justify-content: flex-start;
  }
}
