:root {
  color-scheme: light;
  font-family: Inter, "Microsoft YaHei UI", "Noto Sans SC", system-ui, sans-serif;
  color: #191a2d;
  background: #f3f4f8;
  --ink: #191a2d;
  --muted: #5d6277;
  --accent: #4237b3;
  --accent-dark: #33289b;
  --edge: #dce0eb;
  --soft: #f5f5fa;
  --success: #09684a;
}

* { box-sizing: border-box; }

body { margin: 0; min-width: 280px; }
h1, h2, h3, p { margin: 0; }
input, button { font: inherit; }
button, input[type="checkbox"] { cursor: pointer; }
[hidden] { display: none !important; }

.site-header {
  background: white;
  border-bottom: 1px solid var(--edge);
}

.header-inner,
.workspace {
  width: min(100% - 48px, 1040px);
  margin-inline: auto;
}

.header-inner {
  min-height: 67px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
}

.brand-mark::before {
  content: "";
  width: 16px;
  height: 4px;
  border-inline: 4px solid white;
  border-radius: 4px;
  background: #b1a9fd;
  box-sizing: border-box;
  transform: rotate(-35deg);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 100px;
  background: #eef0f6;
  color: #52596d;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status[data-phase="pairing"],
.status[data-phase="waiting"],
.status[data-phase="connecting"] { color: var(--accent-dark); background: #edeaff; }
.status[data-phase="connected"] { color: var(--success); background: #e4f7ee; }
.status[data-phase="error"] { color: #983136; background: #fff0f0; }

.workspace { padding-block: 54px 44px; }
.page-heading { margin-bottom: 28px; }
.page-heading h1 { font-size: clamp(28px, 5vw, 42px); line-height: 1.15; letter-spacing: -0.035em; }
.page-heading p { margin-top: 11px; color: var(--muted); font-size: 15px; line-height: 1.7; }

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
}

.panel {
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--edge);
  border-radius: 15px;
  background: white;
  box-shadow: 0 2px 4px #23234205;
}

.panel h2 { font-size: 19px; line-height: 1.35; }
.section-description { margin-top: 6px; color: var(--muted); font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.pairing-panel > .button-primary { width: 100%; margin-top: 20px; }

.button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.button-primary { background: var(--accent); color: white; }
.button-primary:hover:not(:disabled) { background: var(--accent-dark); }
.button-secondary { border-color: var(--edge); color: var(--ink); background: white; }
.button-secondary:hover:not(:disabled) { border-color: #afabd3; background: var(--soft); }
.button:disabled { cursor: default; background: var(--soft); color: #656b7e; border-color: #e3e4ed; }

label { font-size: 14px; font-weight: 700; }
.input-row { display: flex; align-items: stretch; gap: 8px; margin-top: 7px; }
input[type="text"] {
  min-width: 0;
  width: 100%;
  min-height: 42px;
  padding: 8px 11px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-size: 14px;
}

input[type="text"]::placeholder { color: #686f83; }
input[type="text"]:disabled { background: var(--soft); }
.button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.invite-panel { margin-top: 14px; }
#invite-link { color: var(--accent-dark); }
.join-form { margin-top: 20px; }
.pairing-options { display: grid; gap: 5px; margin-top: 18px; }
.pairing-options small { color: var(--muted); font-size: 12px; line-height: 1.6; }
.check-label { display: inline-flex; align-items: center; gap: 8px; width: fit-content; min-height: 30px; cursor: pointer; }
.check-label input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
.disconnect { margin-top: 18px; }

.route {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(36px, .45fr) minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 82px;
  margin-top: 17px;
  padding: 12px;
  border: 1px solid #e5e6f0;
  border-radius: 10px;
  background: var(--soft);
}

.endpoint { display: flex; align-items: center; gap: 8px; min-width: 0; }
.endpoint-info { min-width: 0; overflow-wrap: anywhere; }
.endpoint-label { font-size: 13px; font-weight: 700; }
.candidate { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.device-icon {
  width: 16px;
  height: 12px;
  flex: 0 0 auto;
  border: 1.5px solid #696385;
  border-radius: 3px;
  position: relative;
}

.device-icon::after {
  content: "";
  position: absolute;
  width: 8px;
  bottom: -4px;
  left: 2.5px;
  border-bottom: 1.5px solid #696385;
}

.device-peer { width: 11px; height: 17px; }
.device-peer::after { width: 3px; bottom: 2px; left: 2.5px; }
.route-link { text-align: center; font-size: 10px; color: var(--muted); }
.route-line { margin-bottom: 4px; border-top: 1px dashed #8b8fa5; }
.route[data-direct="true"] .route-line { border-top: 2px solid var(--success); }
.route[data-direct="true"] .route-link { color: var(--success); font-weight: 700; }

.test-section { margin-top: 15px; }
.test-header { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.test-header h3 { font-size: 14px; }
.test-header output { color: var(--accent-dark); font-size: 14px; font-variant-numeric: tabular-nums; font-weight: 700; }
.message-form { margin-top: 15px; }
.log-panel { grid-column: 1 / -1; }
.event-log { max-height: 230px; margin: 12px 0 0; padding: 0; list-style: none; overflow: auto; }
.event-log:empty { margin: 0; }
.event-log li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 7px 2px;
  border-top: 1px solid #ececf3;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.event-log li time { color: var(--muted); font-variant-numeric: tabular-nums; }
.event-log li[data-kind="error"] { color: #983136; }

@media (max-width: 720px) {
  .header-inner, .workspace { width: calc(100% - 32px); }
  .header-inner { min-height: 58px; }
  .workspace { padding-block: 34px; }
  .page-heading { margin-bottom: 20px; }
  .dashboard { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .panel { padding: 18px; }
  input[type="text"] { font-size: 16px; }
}
