:root {
  color-scheme: dark;
  --bg: #0b0f14;
  --panel: #141a22;
  --text: #f2f5f8;
  --muted: #9aa7b5;
  --accent: #3dd6c6;
  --danger: #ff6b6b;
  --border: #2a3644;
  --font: "Avenir Next", "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(120% 80% at 50% 0%, #1a2430 0%, var(--bg) 55%);
  color: var(--text);
  font-family: var(--font);
}

.connect-layout {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  align-items: stretch;
}

.shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

.pair {
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem 1.5rem 3rem;
  text-align: center;
}

.sessions-rail {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.25rem 1rem 1.5rem;
  border-right: 1px solid var(--border);
  background: rgba(10, 14, 20, 0.72);
  text-align: left;
}

.sessions-rail-head h2 {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

.sessions-rail-sub {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.session-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.session-list-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.session-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.75rem 0.8rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(20, 26, 34, 0.9);
}

.session-card.active {
  border-color: rgba(61, 214, 198, 0.55);
  box-shadow: 0 0 0 1px rgba(61, 214, 198, 0.2);
}

.session-card-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}

.session-card-id {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.95rem;
  color: var(--text);
  font-weight: 600;
}

.session-card-time {
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.session-card-status {
  font-size: 0.82rem;
  color: var(--muted);
}

.session-card-status.online {
  color: var(--accent);
}

.session-card-status.offline {
  color: #8a94a1;
}

.session-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.session-card-actions button {
  flex: 1 1 auto;
  min-height: 2.15rem;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
}

.session-card-actions button.primary {
  background: var(--accent);
  border-color: transparent;
  color: #04221f;
}

.session-card-actions button.danger {
  color: var(--danger);
  border-color: rgba(255, 107, 107, 0.35);
}

@media (max-width: 820px) {
  .connect-layout {
    grid-template-columns: 1fr;
  }

  .sessions-rail {
    border-right: 0;
    border-bottom: 1px solid var(--border);
    max-height: none;
  }

  .session-list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0.15rem;
  }

  .session-card {
    min-width: min(260px, 85vw);
    flex: 0 0 auto;
  }
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 600;
}

.pair h1 {
  margin: 0;
  font-size: clamp(2.25rem, 6vw, 3.25rem);
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.sub {
  margin: 0;
  max-width: 28rem;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.45;
}

.qr-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  margin: 0.5rem 0 0.25rem;
  padding: 1rem 1.1rem 0.85rem;
  border-radius: 16px;
  background: rgba(20, 26, 34, 0.85);
  border: 1px solid var(--border);
}

.qrcode {
  width: 260px;
  height: 260px;
  padding: 10px;
  border-radius: 12px;
  background: #fff;
}

.qrcode img,
.qrcode canvas {
  display: block;
  width: 260px !important;
  height: 260px !important;
}

.session {
  margin: 0;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.95rem;
  color: var(--accent);
}

.secondary {
  font-size: 0.95rem;
  min-height: 2.5rem;
  padding: 0.45rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.steps {
  margin: 0.75rem 0 0;
  padding: 0 0 0 1.25rem;
  max-width: 28rem;
  text-align: left;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
}

.steps strong {
  color: var(--text);
  font-weight: 600;
}

.pair-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  width: min(380px, 100%);
  margin-top: 0.75rem;
}

.pair-form input {
  font-size: 2.1rem;
  letter-spacing: 0.45em;
  text-align: center;
  padding: 1rem 1.1rem;
  min-height: 4rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  outline: none;
}

.pair-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(61, 214, 198, 0.25);
}

.pair-form button {
  font-size: 1.25rem;
  min-height: 3.5rem;
  padding: 1rem 1.25rem;
  border: 0;
  border-radius: 12px;
  background: var(--accent);
  color: #04221f;
  font-weight: 700;
  cursor: pointer;
}

.pair-form button:active {
  filter: brightness(0.92);
}

.pair-form button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.status {
  margin: 0.5rem 0 0;
  min-height: 1.5rem;
  max-width: 28rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.status.error {
  color: var(--danger);
}

.status.ok {
  color: var(--accent);
}

.footnote {
  margin: 1.75rem 0 0;
  max-width: 26rem;
  color: #6b7785;
  font-size: 0.9rem;
  line-height: 1.4;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.nav-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 1.25rem 0 0;
}

.nav-row a,
.nav-row .linkish {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

.nav-row a:hover,
.nav-row .linkish:hover {
  color: var(--accent);
}
