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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'Arial', sans-serif;
  font-weight: 200;
  background: #fff;
  color: #1a1a1a;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

/* ── Layout ───────────────────────────────────────────── */

.layout {
  display: flex;
  height: 100vh;
}

/* ── Left panel (grey) ────────────────────────────────── */

.left-panel {
  width: 280px;
  min-width: 280px;
  height: 100%;
  background: #f5f5f3;
  display: flex;
  flex-direction: column;
  padding: 32px 28px;
}

.left-header {
  margin-bottom: 32px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.left-header .brand {
  font-size: 1rem;
  font-weight: 400;
  color: #1a1a1a;
  text-decoration: none;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.left-header .nav-logo {
  opacity: 0.85;
}

.left-label {
  font-size: 0.68rem;
  font-weight: 300;
  color: #888;
  line-height: 1.6;
  margin-bottom: 24px;
}

/* ── Connect button ───────────────────────────────────── */

.connect-section {
  margin-bottom: 20px;
}

.connect-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  border: none;
  border-radius: 10px;
  background: #1a1a1a;
  color: #fff;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 300;
  cursor: pointer;
  transition: background 0.15s;
}

.connect-btn:hover { background: #333; }
.connect-btn.connected { background: #2a7a2a; }
.connect-btn.connecting { background: #8a6d1b; }

.connect-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #666;
  flex-shrink: 0;
  transition: background 0.2s;
}

.connect-dot.orange { background: #e8a832; }
.connect-dot.green { background: #5ec45e; }

/* ── Icon grid ────────────────────────────────────────── */

.icon-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

.icon-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 12px;
  transition: background 0.15s;
}

.icon-tile:hover {
  background: rgba(0,0,0,0.04);
}

.icon-tile.active {
  background: rgba(0,0,0,0.06);
}

.icon-tile.disabled {
  opacity: 0.35;
  pointer-events: none;
}

.icon-tile .icon-box {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.icon-tile .icon-box svg,
.icon-tile .icon-box img {
  width: 100%;
  height: 100%;
  border-radius: 12px;
}

.icon-tile .icon-label {
  font-size: 0.75rem;
  font-weight: 300;
  color: #1a1a1a;
}

.icon-tile.active .icon-label {
  font-weight: 400;
}

.badge-beta {
  font-size: 0.5rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #fff;
  background: #1a1a1a;
  padding: 1px 5px;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 4px;
}

/* ── Left footer ──────────────────────────────────────── */

.left-footer {
  margin-top: auto;
}

.left-footer .credit {
  font-size: 0.62rem;
  font-weight: 300;
  color: #999;
  text-decoration: none;
}

.left-footer .credit:hover {
  text-decoration: underline;
}

/* ── Right panel ───────────────────────────────────────── */

.right-panel {
  flex: 1;
  height: 100%;
  position: relative;
}

/* ── App iframe ───────────────────────────────────────── */

.app-frame {
  display: none;
  width: 100%;
  height: 100%;
  border: none;
}

.app-frame.active {
  display: block;
}

/* ── Welcome screen ───────────────────────────────────── */

.welcome-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: #f5f5f3;
}

.welcome-content {
  max-width: 480px;
  padding: 40px;
  text-align: center;
}

.welcome-diagram {
  margin-bottom: 24px;
}

.sp1-welcome-svg {
  width: 260px;
  height: auto;
}

.btn-blink {
  animation: blink-btn 1.2s ease-in-out infinite;
}

.led-blink {
  animation: blink-led 1.2s ease-in-out infinite;
}

@keyframes blink-btn {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

@keyframes blink-led {
  0%, 100% { opacity: 1; fill: #5ec45e; }
  50% { opacity: 0.3; fill: #b0d8b0; }
}

.welcome-title {
  font-size: 1.4rem;
  font-weight: 300;
  margin-bottom: 20px;
}

.welcome-steps {
  text-align: left;
  font-size: 0.78rem;
  font-weight: 300;
  line-height: 2;
  color: #555;
  margin-bottom: 28px;
}

.welcome-info {
  font-size: 0.7rem;
  font-weight: 300;
  color: #999;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
}

.welcome-info a {
  color: #666;
  text-decoration: underline;
}

.welcome-info-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 400;
  color: #aaa;
}

/* ── Mobile notice ────────────────────────────────────── */

.mobile-notice {
  display: none;
}

@media (max-width: 768px) {
  .mobile-notice {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #f5f5f3;
    align-items: center;
    justify-content: center;
    padding: 40px 28px;
  }

  .mobile-notice-inner {
    max-width: 320px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
  }

  .mobile-notice-logo {
    opacity: 0.85;
    margin-bottom: 20px;
  }

  .mobile-notice-brand {
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.3;
    color: #1a1a1a;
    margin-bottom: 32px;
  }

  .mobile-notice-text {
    font-size: 0.82rem;
    font-weight: 300;
    color: #555;
    line-height: 1.7;
    margin-bottom: 16px;
  }

  .mobile-notice-hint {
    font-size: 0.75rem;
    font-weight: 400;
    color: #1a1a1a;
    line-height: 1.6;
    margin-bottom: 48px;
  }

  .mobile-notice-link {
    font-size: 0.62rem;
    font-weight: 300;
    color: #999;
    text-decoration: none;
  }

  .mobile-notice-link:hover {
    text-decoration: underline;
  }

  .layout {
    display: none;
  }
}
