:root {
  color-scheme: light;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: #171717;
  background: #f7f7f8;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(247, 247, 248, 0.96)),
    radial-gradient(circle at 50% 0, rgba(16, 163, 127, 0.14), transparent 28rem);
}

button,
input,
textarea {
  font: inherit;
}

a {
  color: #0f8f6f;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.workspace {
  width: min(100%, 1120px);
  min-height: min(760px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  animation: enter 380ms ease both;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid #ececec;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #111;
  color: #fff;
  font-weight: 700;
  font-size: 0.86rem;
}

.brand-mark img {
  width: 23px;
  height: 23px;
  display: block;
  filter: invert(1);
}

.brand p {
  margin: 0;
  font-weight: 700;
}

.brand span:not(.brand-mark),
.status-pill {
  color: #6b6b6b;
  font-size: 0.88rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid #e4e4e4;
  border-radius: 999px;
  background: #fff;
}

.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10a37f;
}

.conversation {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 24px;
  padding: clamp(28px, 6vw, 72px);
}

.message {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  width: min(100%, 820px);
  margin-inline: auto;
}

.user-panel {
  grid-template-columns: minmax(0, 1fr);
}

.user-panel::before {
  display: none;
}

.bubble {
  max-width: 820px;
  text-align: center;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0 0 10px;
  font-size: clamp(2.35rem, 6vw, 4.9rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
}

.bubble p {
  max-width: 680px;
  margin: 0;
  margin-inline: auto;
  color: #5f6368;
  font-size: 1.06rem;
  line-height: 1.7;
}

.prompt-box {
  width: min(100%, 820px);
  max-width: 820px;
  padding: 16px;
  border: 1px solid #dedede;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.06);
}

label {
  display: block;
  margin-bottom: 10px;
  color: #4b4b4b;
  font-size: 0.94rem;
  font-weight: 650;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

input,
textarea {
  width: 100%;
  border: 1px solid #d7d7d7;
  border-radius: 8px;
  outline: none;
  background: #fff;
  color: #171717;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input {
  min-height: 56px;
  padding: 0 18px;
}

textarea {
  min-height: 190px;
  padding: 14px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.9rem;
  line-height: 1.6;
}

input:focus,
textarea:focus {
  border-color: #10a37f;
  box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.14);
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  cursor: pointer;
  background: #111;
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  transition: transform 140ms ease, background 140ms ease, opacity 140ms ease;
}

button:hover {
  background: #2b2b2b;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.is-busy .spinner {
  display: inline-block;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.modal[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  width: min(100%, 680px);
  max-height: min(760px, calc(100vh - 36px));
  overflow: auto;
  border: 1px solid #e3e3e3;
  border-radius: 8px;
  background: #fff;
  padding: 28px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.2);
  transform: translateY(10px) scale(0.98);
  transition: transform 180ms ease;
}

.modal[aria-hidden="false"] .modal-card {
  transform: translateY(0) scale(1);
}

.icon-button {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  min-height: 34px;
  padding: 0;
  background: #f4f4f4;
  color: #555;
  font-size: 1.2rem;
}

.icon-button:hover {
  background: #ebebeb;
}

.eyebrow {
  margin: 0 0 8px;
  color: #10a37f;
  font-size: 0.86rem;
  font-weight: 800;
}

h2 {
  margin: 0 36px 18px 0;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  line-height: 1.15;
}

.modal-body {
  color: #3f3f3f;
}

.modal-body p {
  line-height: 1.7;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
}

.primary-action {
  background: #10a37f;
  color: #fff;
  box-shadow: 0 12px 24px rgba(16, 163, 127, 0.22);
}

.primary-action:hover {
  background: #0d8f70;
}

.ghost-action {
  border: 1px solid #ececec;
  background: transparent;
  color: #777;
  font-weight: 650;
}

.ghost-action:hover {
  background: #f7f7f7;
  color: #333;
}

.remote-result {
  display: grid;
  gap: 12px;
}

.status-result {
  display: grid;
  gap: 14px;
}

.status-result > p {
  margin: 0;
  color: #555;
  line-height: 1.7;
}

.remote-result .rounded-xl,
.notice {
  border-radius: 8px;
}

.remote-result [class*="p-4"],
.notice {
  padding: 14px;
}

.remote-result .bg-red-500\/20,
.notice-error {
  border: 1px solid #ffc7cf;
  background: #fff0f2;
  color: #9f1239;
}

.remote-result .bg-green-500\/20,
.remote-result .bg-emerald-500\/20 {
  border: 1px solid #b9eadc;
  background: #effcf7;
  color: #067a5f;
}

.remote-result .bg-yellow-500\/20,
.remote-result .bg-orange-500\/20,
.remote-result .bg-orange-400\/10,
.remote-result .bg-orange-900\/20,
.remote-result .bg-yellow-400\/10 {
  border: 1px solid #f6dea6;
  background: #fff8e7;
  color: #8a5a00;
}

.remote-result .flex {
  display: flex;
}

.remote-result .items-center {
  align-items: center;
}

.remote-result .gap-3 {
  gap: 12px;
}

.remote-result svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.remote-result p {
  margin: 0;
}

.json-form {
  display: grid;
  gap: 16px;
}

.workflow-result {
  display: grid;
  gap: 14px;
}

.workflow-result > p {
  margin: 0;
  color: #555;
  line-height: 1.7;
}

.polling-note {
  padding: 12px 14px;
  border: 1px solid #d9eee8;
  border-radius: 8px;
  background: #f1fbf8;
  color: #0d755e;
}

.locked-code {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid #e7e7e7;
  border-radius: 8px;
  background: #f7f7f8;
}

.locked-code span {
  color: #6b6b6b;
}

.guide {
  padding: 16px;
  border: 1px solid #e7e7e7;
  border-radius: 8px;
  background: #fcfcfc;
}

.guide h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.guide ol {
  margin: 0;
  padding-left: 1.25rem;
  color: #555;
  line-height: 1.8;
}

@media (max-width: 640px) {
  .app-shell {
    padding: 12px;
    place-items: stretch;
  }

  .workspace {
    min-height: calc(100vh - 24px);
  }

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

  .status-pill {
    display: none;
  }

  .conversation {
    align-content: center;
    padding: 28px 18px;
  }

  h1 {
    font-size: clamp(2.45rem, 13vw, 4rem);
  }

  .message,
  .user-panel {
    grid-template-columns: 1fr;
  }

  .user-panel::before {
    display: none;
  }

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

  .modal-card {
    padding: 22px;
  }

  .modal-actions,
  .locked-code {
    display: grid;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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