:root {
  color-scheme: light;
  font-family: ui-rounded, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #000;
}

.simulator-page {
  position: fixed;
  inset: 0;
}

.simulator-page iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.simulator-wallet {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 10;
  display: flex;
  height: 42px;
  align-items: center;
  gap: 8px;
  padding: 4px 13px 4px 5px;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 10px 28px rgba(22, 31, 51, 0.16);
  color: #16345c;
  font: inherit;
  font-weight: 900;
}

.simulator-wallet span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 2px solid #e1a822;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff2a8 0 12%, #f5c94d 44%, #d79518 100%);
  color: #704508;
}

.simulator-wallet b {
  min-width: 24px;
  font-variant-numeric: tabular-nums;
}

.pair-card[hidden] {
  display: none;
}

/* 手機配對 QR 卡片：左上小圖示，hover／點擊／等待配對時放大置中。 */
.pair-card {
  --navy: #16345c;
  --muted: #68717a;
  position: fixed;
  top: calc(env(safe-area-inset-top) + 66px);
  left: 18px;
  z-index: 1200;
  display: block;
  width: 58px;
  height: 58px;
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
}

.pair-card::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  background: rgba(10, 24, 37, 0.46);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.pair-card img {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 74px);
  left: 26px;
  z-index: 1;
  display: block;
  width: 42px;
  height: 42px;
  padding: 3px;
  border-radius: 8px;
  background: #fbfbf7;
  object-fit: contain;
  box-shadow: 0 10px 26px rgba(16, 29, 48, 0.16);
  transform: translate(0, 0);
  transition: top 220ms ease, left 220ms ease, width 220ms ease, height 220ms ease, padding 220ms ease, transform 220ms ease, box-shadow 220ms ease;
}

.pair-card .signal {
  position: fixed;
  top: calc(50% + min(35vmin, 260px) + 96px);
  left: 50%;
  z-index: 1;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.9);
  transition: opacity 160ms ease, transform 220ms ease;
}

.pair-card:hover::before,
.pair-card.is-hovered::before,
.pair-card.is-waiting::before {
  opacity: 1;
}

.pair-card:hover .signal,
.pair-card.is-hovered .signal,
.pair-card.is-waiting .signal {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.pair-card:hover img,
.pair-card.is-hovered img,
.pair-card.is-waiting img {
  top: 50%;
  left: 50%;
  width: min(70vmin, 520px);
  height: min(70vmin, 520px);
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 28px 90px rgba(4, 17, 28, 0.42);
  transform: translate(-50%, -50%);
}

.signal {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  border: 1px solid rgba(255, 255, 255, 0.62);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: 0 10px 28px rgba(22, 31, 51, 0.08);
  color: var(--navy);
}

.signal span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #a9a795;
  box-shadow: 0 0 0 5px rgba(169, 167, 149, 0.18);
}

.signal[data-state="connected"] span {
  background: #53bd69;
  box-shadow: 0 0 0 5px rgba(83, 189, 105, 0.18);
}

.signal[data-state="connected"][data-peer="true"] span {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  background: var(--navy);
  box-shadow: none;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.signal[data-state="error"] span {
  background: #d75c46;
  box-shadow: 0 0 0 5px rgba(215, 92, 70, 0.18);
}

.signal b {
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.signal__peers {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  display: none;
  min-width: 180px;
  margin: 0;
  padding: 8px;
  list-style: none;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 14px 36px rgba(22, 31, 51, 0.14);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  transform: translateX(-50%);
}

.signal[data-has-peers="true"] .signal__peers {
  display: grid;
  gap: 4px;
}

.signal__peers li {
  overflow: hidden;
  padding: 7px 9px;
  border-radius: 9px;
  background: rgba(32, 53, 95, 0.06);
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
