:root {
  color-scheme: light;
  --bg-top: #dceef8;
  --bg-bottom: #f7fbfd;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-border: rgba(18, 50, 71, 0.12);
  --text-main: #10212d;
  --text-soft: #52626d;
  --accent: #0b7fab;
  --accent-deep: #085f82;
  --accent-soft: rgba(11, 127, 171, 0.12);
  --success: #187a57;
  --warn: #a85f05;
  --danger: #b53d2f;
  --shadow: 0 24px 70px rgba(16, 33, 45, 0.12);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --mono: "Consolas", "SFMono-Regular", monospace;
  --sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text-main);
  background:
    radial-gradient(circle at top left, rgba(11, 127, 171, 0.18), transparent 32%),
    radial-gradient(circle at right center, rgba(24, 122, 87, 0.14), transparent 28%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.28) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.28) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.48), transparent 85%);
  pointer-events: none;
}

.fallback-toast {
  position: fixed;
  top: 16px;
  left: 50%;
  z-index: 9999;
  width: min(calc(100% - 24px), 520px);
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(16, 33, 45, 0.94);
  color: #f3fbff;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
  transform: translate(-50%, -12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.fallback-toast-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.fallback-toast strong {
  display: block;
  margin-bottom: 4px;
}

.fallback-toast p {
  margin: 0;
  line-height: 1.55;
}

.guide-modal {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 28, 37, 0.42);
  backdrop-filter: blur(10px);
}

.guide-modal-card {
  width: min(100%, 520px);
  padding: 24px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 30px 80px rgba(16, 33, 45, 0.22);
}

.guide-modal-copy {
  margin: 12px 0 0;
  color: var(--text-soft);
  line-height: 1.7;
}

.guide-modal-steps {
  margin: 14px 0 0;
  padding-left: 20px;
  color: var(--text-main);
  line-height: 1.7;
}

.guide-modal-steps li {
  margin-bottom: 8px;
}

.guide-modal-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.hero-card,
.panel {
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
  padding: 26px;
  border: 1px solid var(--panel-border);
  border-radius: var(--radius-xl);
  background: var(--panel);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.hero-card::after,
.panel::after {
  content: "";
  position: absolute;
  inset: auto -60px -70px auto;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(11, 127, 171, 0.16), transparent 68%);
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-deep);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  max-width: 760px;
}

h2 {
  font-size: 1.2rem;
}

.hero-copy,
.hero-note {
  max-width: 840px;
  color: var(--text-soft);
  line-height: 1.7;
}

.endpoint-grid,
.form-grid,
.button-row,
.diagnostics-grid {
  display: grid;
  gap: 14px;
}

.endpoint-grid {
  margin: 24px 0 14px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.endpoint-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(11, 127, 171, 0.1);
}

.endpoint-label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.endpoint-value,
code,
.code-block {
  font-family: var(--mono);
}

.endpoint-value {
  display: block;
  color: var(--accent-deep);
  word-break: break-all;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(168, 95, 5, 0.12);
  color: var(--warn);
  font-size: 0.9rem;
  font-weight: 700;
}

.status-pill-ok {
  background: rgba(24, 122, 87, 0.12);
  color: var(--success);
}

.status-pill-error {
  background: rgba(181, 61, 47, 0.12);
  color: var(--danger);
}

.status-pill-neutral {
  background: rgba(82, 98, 109, 0.12);
  color: var(--text-soft);
}

.form-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-bottom: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-size: 0.95rem;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid rgba(16, 33, 45, 0.14);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text-main);
  font: inherit;
  padding: 13px 14px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: rgba(11, 127, 171, 0.48);
  box-shadow: 0 0 0 4px rgba(11, 127, 171, 0.12);
  transform: translateY(-1px);
}

textarea {
  resize: vertical;
}

.button-row {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  box-shadow: 0 10px 20px rgba(11, 127, 171, 0.18);
}

.button:hover {
  transform: translateY(-1px);
}

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

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.button-secondary {
  color: var(--accent-deep);
  background: rgba(11, 127, 171, 0.12);
  box-shadow: none;
}

.button-ghost {
  color: var(--text-main);
  background: rgba(16, 33, 45, 0.08);
  box-shadow: none;
}

.protocol-panel .code-block {
  margin: 0;
}

.diagnostics-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.diagnostics-summary {
  margin-bottom: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(16, 33, 45, 0.08);
  color: var(--text-main);
  line-height: 1.65;
}

.diagnostics-summary strong {
  display: block;
  margin-bottom: 6px;
}

.diagnostics-summary p {
  margin: 0;
}

.install-guide-content {
  color: var(--text-soft);
  line-height: 1.7;
}

.install-guide-content p {
  margin: 0 0 10px;
}

.install-guide-content ol {
  margin: 0;
  padding-left: 20px;
}

.install-guide-content li {
  margin-bottom: 8px;
}

.diagnostic-item {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(16, 33, 45, 0.08);
}

.diagnostic-item strong {
  display: block;
  margin-bottom: 8px;
  font-size: 0.96rem;
}

.diagnostic-item span {
  display: inline-flex;
  margin-bottom: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.diagnostic-item p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.55;
  word-break: break-word;
}

.diagnostic-pass span {
  background: rgba(24, 122, 87, 0.12);
  color: var(--success);
}

.diagnostic-warn span {
  background: rgba(168, 95, 5, 0.12);
  color: var(--warn);
}

.diagnostic-fail span {
  background: rgba(181, 61, 47, 0.12);
  color: var(--danger);
}

.code-block {
  overflow: auto;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: #0f1c25;
  color: #d8ecf7;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-output {
  display: grid;
  gap: 10px;
}

.message-preview {
  margin-bottom: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(11, 127, 171, 0.12), rgba(18, 50, 71, 0.08));
  border: 1px solid rgba(11, 127, 171, 0.16);
}

.message-preview strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-deep);
}

.message-preview p {
  margin: 0;
  color: var(--text-main);
  line-height: 1.6;
}

.message-preview small {
  display: block;
  margin-top: 10px;
  color: var(--text-soft);
}

.log-entry {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(16, 33, 45, 0.08);
}

.log-entry strong {
  display: inline-block;
  margin-right: 8px;
}

.log-entry-info strong {
  color: var(--accent-deep);
}

.log-entry-success strong {
  color: var(--success);
}

.log-entry-error strong {
  color: var(--danger);
}

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 18px, 1120px);
    padding-top: 14px;
  }

  .hero-card,
  .panel {
    padding: 18px;
    border-radius: 22px;
  }

  .fallback-toast {
    top: 10px;
  }

  .guide-modal-card {
    padding: 18px;
    border-radius: 22px;
  }
}
