#pjh-public-room-widget {
  position: fixed;
  left: max(20px, env(safe-area-inset-left, 0px));
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  z-index: 1200;
  display: none;
  background: transparent;
  color: var(--text, #333);
  font-family: var(--font, "Microsoft YaHei", sans-serif);
  pointer-events: none;
}

#pjh-public-room-widget[data-visible="true"] {
  display: block;
}

#pjh-public-room-widget button {
  font: inherit;
}

#pjh-public-room-widget .pjh-pr-entry {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 7px 13px 7px 10px;
  border: 2px solid var(--line-strong, #a8a8a8);
  border-radius: 7px;
  background: var(--panel, #fff);
  color: var(--text, #333);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .14);
  cursor: pointer;
  pointer-events: auto;
  transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

#pjh-public-room-widget .pjh-pr-entry:hover {
  background: var(--brand-soft, color-mix(in srgb, var(--brand, #e60000) 10%, var(--panel, #fff)));
  box-shadow: 4px 4px 0 rgba(0, 0, 0, .17);
  transform: translateY(-1px);
}

#pjh-public-room-widget .pjh-pr-entry:focus-visible {
  outline: 3px solid var(--accent, #0090f0);
  outline-offset: 3px;
}

#pjh-public-room-widget .pjh-pr-entry:disabled {
  cursor: wait;
  opacity: .72;
  transform: none;
}

#pjh-public-room-widget .pjh-pr-icon {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border: 1px solid var(--line, #c8c8c8);
  border-radius: 5px;
  background:
    linear-gradient(90deg, transparent 46%, var(--accent, #0090f0) 47%, var(--accent, #0090f0) 53%, transparent 54%),
    linear-gradient(transparent 46%, var(--accent, #0090f0) 47%, var(--accent, #0090f0) 53%, transparent 54%),
    var(--bg, #f0f0f0);
  color: var(--brand, #e60000);
  font-size: 11px;
  font-weight: 700;
}

#pjh-public-room-widget .pjh-pr-entry-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}

#pjh-public-room-widget .pjh-pr-entry-title {
  font-size: 13px;
  font-weight: 700;
}

#pjh-public-room-widget .pjh-pr-entry-note {
  margin-top: 3px;
  color: var(--text-dim, #707070);
  font-size: 10px;
}

#pjh-public-room-widget .pjh-pr-frame-shell {
  position: relative;
  display: none;
  width: 280px;
  height: 120px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  pointer-events: auto;
}

#pjh-public-room-widget[data-state="opening"] .pjh-pr-frame-shell,
#pjh-public-room-widget[data-state="room"] .pjh-pr-frame-shell,
#pjh-public-room-widget[data-state="error"] .pjh-pr-frame-shell {
  display: block;
}

#pjh-public-room-widget[data-state="opening"] .pjh-pr-entry,
#pjh-public-room-widget[data-state="room"] .pjh-pr-entry {
  display: none;
}

#pjh-public-room-widget .pjh-pr-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
}

#pjh-public-room-widget[data-state="opening"] .pjh-pr-frame {
  visibility: hidden;
}

#pjh-public-room-widget[data-state="error"] .pjh-pr-frame {
  visibility: hidden;
}

#pjh-public-room-widget .pjh-pr-loading,
#pjh-public-room-widget .pjh-pr-error {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: 8px;
  background: transparent;
  color: var(--text, #333);
  text-align: center;
}

#pjh-public-room-widget[data-state="opening"] .pjh-pr-loading {
  display: grid;
}

#pjh-public-room-widget[data-state="error"] .pjh-pr-error {
  display: grid;
}

#pjh-public-room-widget[data-state="error"] .pjh-pr-entry {
  display: none;
}

#pjh-public-room-widget .pjh-pr-loading-card {
  display: grid;
  justify-items: center;
  gap: 10px;
  max-width: 320px;
  padding: 14px 18px;
  border: 1px solid var(--line-strong, #a8a8a8);
  border-radius: 7px;
  background: var(--panel, #fff);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
}

#pjh-public-room-widget .pjh-pr-spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--line-light, #e8e8e8);
  border-top-color: var(--brand, #e60000);
  border-radius: 50%;
  animation: pjh-pr-spin .8s linear infinite;
}

#pjh-public-room-widget .pjh-pr-loading-title,
#pjh-public-room-widget .pjh-pr-error-title {
  font-size: 14px;
  font-weight: 700;
}

#pjh-public-room-widget .pjh-pr-loading-text,
#pjh-public-room-widget .pjh-pr-error-text {
  max-width: 290px;
  color: var(--text-dim, #707070);
  font-size: 12px;
  line-height: 1.6;
}

#pjh-public-room-widget .pjh-pr-error-actions {
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

#pjh-public-room-widget .pjh-pr-error-actions button {
  padding: 5px 12px;
  border: 2px solid var(--line, #c8c8c8);
  background: var(--bg, #f0f0f0);
  color: var(--text, #333);
  cursor: pointer;
}

#pjh-public-room-widget .pjh-pr-error-actions .pjh-pr-retry {
  border-color: var(--brand, #e60000);
  background: var(--brand, #e60000);
  color: #fff;
}

#pjh-public-room-widget .pjh-pr-close {
  position: absolute;
  top: -36px;
  right: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px solid var(--panel, #fff);
  border-radius: 50%;
  background: rgba(0, 0, 0, .72);
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .26);
  cursor: pointer;
  line-height: 1;
}

#pjh-public-room-widget .pjh-pr-close:hover,
#pjh-public-room-widget .pjh-pr-close:focus-visible {
  background: var(--brand, #e60000);
  outline: none;
}

#pjh-public-room-widget[data-state="error"] .pjh-pr-close {
  display: none;
}

@keyframes pjh-pr-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
  #pjh-public-room-widget {
    left: max(10px, env(safe-area-inset-left, 0px));
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 520px) {
  #pjh-public-room-widget {
    left: max(8px, env(safe-area-inset-left, 0px));
    bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  }

  #pjh-public-room-widget .pjh-pr-entry {
    min-height: 36px;
    padding: 5px 10px 5px 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #pjh-public-room-widget .pjh-pr-entry,
  #pjh-public-room-widget .pjh-pr-spinner {
    transition: none;
    animation: none;
  }
}
