:root {
  color-scheme: light dark;
  --page: #f4f7fb;
  --surface: rgba(255, 255, 255, .88);
  --surface-solid: #fff;
  --ink: #182230;
  --muted: #5d6b7b;
  --border: #dce4ee;
  --primary: #0a7cff;
  --primary-dark: #0063d1;
  --success: #138a5b;
  --success-soft: #e8f7ef;
  --danger: #c83737;
  --danger-soft: #fff0f0;
  --warning: #a86600;
  --shadow: 0 24px 60px rgba(27, 54, 86, .14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { min-width: 320px; margin: 0; color: var(--ink); background: radial-gradient(circle at 10% 0%, #d9efff 0, transparent 31rem), radial-gradient(circle at 100% 95%, #e1f7eb 0, transparent 32rem), var(--page); }
button { font: inherit; }
button:focus-visible, summary:focus-visible { outline: 3px solid rgba(10, 124, 255, .4); outline-offset: 3px; }

.page-shell { width: min(100% - 32px, 720px); margin: 56px auto; }
.connection-card, .diagnostics { border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(14px); }
.connection-card { padding: clamp(24px, 5vw, 44px); border-radius: 24px; }
.hero { text-align: center; }
.brand-mark { display: grid; width: 54px; height: 54px; margin: 0 auto 18px; place-items: center; color: white; font-size: 25px; font-weight: 800; letter-spacing: -1px; background: linear-gradient(145deg, #128c7e, #075e54); border-radius: 17px; box-shadow: 0 12px 24px rgba(7, 94, 84, .25); }
.eyebrow, .section-kicker { margin: 0 0 6px; color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
h1, h2 { margin: 0; letter-spacing: -.035em; }
h1 { font-size: clamp(27px, 5vw, 36px); }
h2 { font-size: 17px; }
.intro { max-width: 510px; margin: 15px auto 28px; color: var(--muted); font-size: 15px; line-height: 1.6; }
.connect-button { display: flex; width: 100%; min-height: 57px; align-items: center; justify-content: center; gap: 10px; border: 0; border-radius: 14px; color: #fff; font-weight: 750; cursor: pointer; background: linear-gradient(135deg, var(--primary), #0874e8); box-shadow: 0 11px 22px rgba(10, 124, 255, .25); transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease; }
.connect-button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 14px 27px rgba(10, 124, 255, .32); }
.connect-button:disabled { cursor: wait; opacity: .58; }
.button-icon { font-size: 22px; line-height: 0; transform: translateY(-1px); }
.button-hint { min-height: 20px; margin: 10px 0 0; color: var(--muted); font-size: 13px; text-align: center; }

.status-panel, .event-panel, .success-section { margin-top: 28px; padding: 21px; border: 1px solid var(--border); border-radius: 17px; background: var(--surface-solid); }
.section-heading, .success-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-heading.compact { margin-bottom: 14px; }
.status-badge { padding: 6px 10px; border-radius: 99px; font-size: 12px; font-weight: 750; white-space: nowrap; }
.status-pending { color: #657386; background: #edf1f5; }
.status-active { color: var(--primary-dark); background: #e8f3ff; }
.status-success { color: var(--success); background: var(--success-soft); }
.status-error { color: var(--danger); background: var(--danger-soft); }
.status-list { display: grid; gap: 12px; padding: 18px 0 0; margin: 0; list-style: none; }
.status-item { position: relative; display: flex; align-items: start; gap: 11px; color: var(--muted); font-size: 14px; line-height: 1.4; }
.status-dot { flex: 0 0 auto; width: 10px; height: 10px; margin-top: 5px; border: 2px solid #b8c3ce; border-radius: 50%; }
.status-item.active { color: var(--ink); font-weight: 650; }.status-item.active .status-dot { border-color: var(--primary); background: var(--primary); box-shadow: 0 0 0 4px #e7f2ff; }
.status-item.done .status-dot { border-color: var(--success); background: var(--success); }.status-item.error { color: var(--danger); }.status-item.error .status-dot { border-color: var(--danger); background: var(--danger); }

.success-section { border-color: #bfe7d0; background: linear-gradient(145deg, #fff, var(--success-soft)); }
.success-icon { display: grid; width: 37px; height: 37px; place-items: center; border-radius: 50%; color: #fff; font-size: 21px; font-weight: 900; background: var(--success); }
.success-note { margin: 16px 0; color: #426353; font-size: 13px; line-height: 1.5; }
.result-cards { display: grid; gap: 10px; }
.result-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 13px 14px; border: 1px solid #cae8d7; border-radius: 11px; background: rgba(255,255,255,.78); }
.result-label { display: block; margin-bottom: 4px; color: #547160; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }.result-value { display: block; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; font-weight: 650; }
.copy-button, .text-button { border: 0; border-radius: 7px; color: var(--primary-dark); font-size: 12px; font-weight: 750; cursor: pointer; background: #eaf4ff; }.copy-button { padding: 8px 10px; }.text-button { padding: 6px 8px; }.copy-button:hover, .text-button:hover { background: #dbeeff; }

.event-log { display: grid; gap: 10px; max-height: 260px; overflow: auto; padding-right: 3px; }.empty-event { margin: 3px 0; color: var(--muted); font-size: 13px; }.event-entry { padding: 12px; border-left: 3px solid var(--primary); border-radius: 8px; background: #f5f8fb; }.event-entry.error { border-color: var(--danger); background: var(--danger-soft); }.event-meta { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 7px; color: var(--muted); font-size: 11px; }.event-name { color: var(--ink); font-weight: 800; letter-spacing: .04em; }.event-entry pre, #payload-json { margin: 0; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: #344354; font: 12px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }

.diagnostics { margin-top: 18px; border-radius: 16px; overflow: hidden; }.diagnostics summary { display: flex; align-items: center; justify-content: space-between; padding: 17px 20px; font-size: 14px; font-weight: 750; cursor: pointer; list-style: none; }.diagnostics summary::-webkit-details-marker { display: none; }.diagnostics[open] summary span { transform: rotate(180deg); }.diagnostics-content { padding: 0 20px 20px; }.diagnostics-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 16px; margin: 0 0 17px; font-size: 13px; }.diagnostics-list dt { color: var(--muted); }.diagnostics-list dd { margin: 0; overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }.json-wrap { overflow: hidden; border: 1px solid var(--border); border-radius: 10px; }.json-heading { display: flex; align-items: center; justify-content: space-between; padding: 9px 11px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 12px; font-weight: 750; }.json-wrap pre { max-height: 280px; padding: 13px; background: #f7f9fb; }
noscript { display: block; margin: 20px; color: var(--danger); text-align: center; }

@media (max-width: 520px) { .page-shell { width: min(100% - 20px, 720px); margin: 18px auto; }.connection-card { padding: 22px 17px; border-radius: 18px; }.status-panel, .event-panel, .success-section { padding: 17px; }.diagnostics-list { grid-template-columns: 1fr; gap: 4px; }.diagnostics-list dd { margin-bottom: 9px; }.result-card { grid-template-columns: 1fr; }.copy-button { justify-self: start; } }
@media (prefers-color-scheme: dark) { :root { --page: #101a25; --surface: rgba(24, 35, 48, .9); --surface-solid: #1b2936; --ink: #edf4fa; --muted: #aebdca; --border: #334657; --success-soft: #143a2c; --danger-soft: #472428; --shadow: 0 24px 60px rgba(0, 0, 0, .28); } body { background: radial-gradient(circle at 10% 0%, #153b60 0, transparent 31rem), radial-gradient(circle at 100% 95%, #153b2b 0, transparent 32rem), var(--page); }.event-entry { background: #243542; }.event-entry pre, #payload-json { color: #d5e0e8; }.result-card { background: rgba(12, 34, 25, .42); }.success-note, .result-label { color: #b2d9c1; }.json-wrap pre { background: #15222e; }.status-pending { background: #2c3c4b; color: #c5d0d9; }.text-button, .copy-button { background: #173b5e; color: #a8d7ff; } }
