* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f5f7f5;
  color: #182830;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Two-panel layout ─── */

.page-layout {
  display: flex;
  gap: 3rem;
  padding: 2rem;
  max-width: 960px;
  width: 100%;
  align-items: flex-start;
}

.panel {
  flex: 1;
}

.panel-connect {
  text-align: center;
  position: sticky;
  top: 2rem;
}

.panel-tutorial {
  text-align: left;
  padding-top: 0.5rem;
}

/* Responsive: stack on small screens */
@media (max-width: 700px) {
  .page-layout {
    flex-direction: column;
    gap: 2rem;
    align-items: center;
  }
  .panel-connect {
    position: static;
  }
  .panel {
    max-width: 500px;
    width: 100%;
  }
}

/* ── Connection panel ─── */

.app-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.app-logo {
  width: 52px;
  height: 52px;
  border-radius: 12px;
}

h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1A5080;
  margin-bottom: 0;
  text-align: left;
}

.subtitle {
  font-size: 0.85rem;
  color: #405860;
  text-align: left;
  margin: 0;
}

#status {
  font-size: 0.95rem;
  color: #405860;
  margin-bottom: 1.5rem;
  min-height: 1.4em;
}

#qrcode {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 1rem;
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

#session-code {
  display: none;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: #1A5080;
  margin-bottom: 1.5rem;
  font-family: "SF Mono", "Fira Code", monospace;
}

.hidden {
  display: none !important;
}

/* ── Tutorial panel ─── */

.panel-tutorial h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #1A5080;
  margin-bottom: 1.5rem;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.step {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.step-number {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #1A5080;
  color: white;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.step-content h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: #182830;
  margin-bottom: 0.2rem;
}

.step-content p {
  font-size: 0.82rem;
  color: #405860;
  line-height: 1.5;
}

.step-content .hint {
  font-size: 0.78rem;
  color: #789098;
  margin-top: 0.25rem;
  font-style: italic;
}

.install-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.install-qr {
  flex-shrink: 0;
  border-radius: 6px;
  overflow: hidden;
  line-height: 0;
}

.store-link {
  display: inline-block;
  margin-top: 0.3rem;
  font-size: 0.82rem;
  color: #1A5080;
  font-weight: 500;
  text-decoration: none;
}

.store-link:hover {
  text-decoration: underline;
}

/* ── Connected phase ─── */

#connected-phase {
  width: 100%;
}

.connected-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.2rem;
  background: rgba(46, 125, 82, 0.1);
  border-radius: 20px;
  color: #2E7D52;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.connected-badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2E7D52;
}

.connected-hint {
  font-size: 0.85rem;
  color: #405860;
  margin-bottom: 1.5rem;
}

#messages {
  text-align: left;
  max-height: 400px;
  overflow-y: auto;
  padding: 1rem;
  background: white;
  border-radius: 12px;
  border: 1px solid #CCD4CE;
  font-family: "SF Mono", "Fira Code", monospace;
  font-size: 0.8rem;
  color: #182830;
}

.message {
  padding: 0.3rem 0;
  border-bottom: 1px solid #f0f0f0;
  word-break: break-all;
}

.message:last-child {
  border-bottom: none;
}
