:root {
  --party-panel: rgba(18, 18, 18, 0.94);
  --party-panel-soft: rgba(255, 255, 255, 0.07);
  --party-border: rgba(255, 255, 255, 0.16);
  --party-muted: rgba(255, 255, 255, 0.66);
  --party-blue: #007bff;
  --party-pink: #fe1fa9;
  --party-green: #4caf50;
  --party-red: #f44336;
  --party-shadow: 0 12px 34px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --party-font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "Inter", Roboto, Arial, sans-serif;
}

.party-session-bar {
  position: fixed;
  top: 14px;
  right: 16px;
  z-index: 1200;
  width: min(560px, calc(100vw - 78px));
  padding: 12px 14px;
  color: #fff;
  background: var(--party-panel);
  border: 1px solid var(--party-border);
  border-radius: 14px;
  box-shadow: var(--party-shadow);
  font-family: var(--party-font);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.party-session-bar[hidden] {
  display: none;
}

.party-session-heading,
.party-session-source-row,
.party-session-actions {
  display: flex;
  align-items: center;
}

.party-session-heading {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.party-session-heading-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  gap: 8px;
}

.party-session-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.party-session-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--party-muted);
  font-size: 11px;
}

.party-session-status::before {
  width: 7px;
  height: 7px;
  content: "";
  background: #f39c12;
  border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
}

.party-session-close {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  cursor: pointer;
  transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.party-session-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.24);
}

.party-session-bar[data-status="connected"] .party-session-status {
  color: #75dc80;
}

.party-session-bar[data-status="connected"] .party-session-status::before {
  background: var(--party-green);
}

.party-session-bar[data-status="unavailable"] .party-session-status,
.party-session-bar[data-status="expired"] .party-session-status,
.party-session-bar[data-status="invalid"] .party-session-status {
  color: #ff8e86;
}

.party-session-bar[data-status="unavailable"] .party-session-status::before,
.party-session-bar[data-status="expired"] .party-session-status::before,
.party-session-bar[data-status="invalid"] .party-session-status::before {
  background: var(--party-red);
}

.party-session-source-row {
  width: 100%;
  min-height: 42px;
  padding: 6px 8px;
  gap: 8px;
  color: #fff;
  background: var(--party-panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 9px;
  font-family: var(--party-font);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.party-session-source-row:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.party-session-source-row:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.party-session-source-label {
  color: var(--party-muted);
  font-size: 12px;
  font-weight: 650;
}

.party-session-actions {
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.party-session-button,
.party-primary-button {
  min-height: 32px;
  padding: 7px 10px;
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  font-family: var(--party-font);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, opacity 0.18s ease;
}

.party-session-button:hover:not(:disabled),
.party-primary-button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
  transform: translateY(-1px);
}

.party-session-button:focus-visible,
.party-primary-button:focus-visible,
.party-session-close:focus-visible,
.party-dialog-close:focus-visible,
.party-code-form input:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.party-session-button:disabled,
.party-primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.party-session-button-accent,
.party-primary-button {
  background: linear-gradient(135deg, var(--party-pink), rgba(254, 31, 169, 0.78));
  border-color: rgba(255, 255, 255, 0.24);
}

.party-session-button-accent:hover:not(:disabled),
.party-primary-button:hover:not(:disabled) {
  background: linear-gradient(135deg, #ff48bb, var(--party-pink));
}

.party-panel-nav-button[aria-expanded="true"] {
  background: linear-gradient(135deg, rgba(254, 31, 169, 0.28), rgba(0, 123, 255, 0.18));
  border-color: rgba(254, 31, 169, 0.42);
}

.party-panel-nav-button:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.party-pairing-dialog {
  width: min(390px, calc(100vw - 32px));
  padding: 20px;
  color: #fff;
  background: #181818;
  border: 1px solid var(--party-border);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  font-family: var(--party-font);
}

.party-pairing-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(3px);
}

.party-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.party-dialog-kicker {
  color: var(--party-muted);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.party-dialog-header h2 {
  margin-top: 4px;
  font-size: 20px;
  line-height: 1.15;
}

.party-dialog-close {
  width: 30px;
  height: 30px;
  color: #fff;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

.party-dialog-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.party-qr-frame {
  width: min(270px, 100%);
  aspect-ratio: 1;
  margin: 20px auto 16px;
  padding: 10px;
  background: #fff;
  border-radius: 10px;
}

.party-qr-frame svg {
  display: block;
  width: 100%;
  height: 100%;
}

.party-dialog-help {
  margin: 0;
  color: var(--party-muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

/* Public watch surface */
.party-watch-page {
  min-height: 100vh;
  margin: 0;
  color: #fff;
  background: #121212;
  font-family: var(--party-font);
}

.party-watch-page *,
.party-watch-page *::before,
.party-watch-page *::after {
  box-sizing: border-box;
}

.party-watch-shell {
  position: relative;
  min-height: 100vh;
}

.party-watch-chrome {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 56px;
  padding: 0 22px;
  color: rgba(255, 255, 255, 0.7);
  background: rgba(18, 18, 18, 0.92);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 13px;
}

.party-watch-chrome[hidden] {
  display: none;
}

.party-brand {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
}

.party-brand-divider {
  color: rgba(255, 255, 255, 0.28);
}

.party-code-view {
  display: grid;
  place-items: center;
  width: min(440px, calc(100% - 32px));
  min-height: calc(100vh - 56px);
  margin: 0 auto;
  padding: 56px 0;
  text-align: center;
}

.party-code-view[hidden] {
  display: none;
}

.party-panel-mark {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--party-blue), var(--party-pink));
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 123, 255, 0.2);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.party-code-view h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.05;
}

.party-code-view > p {
  max-width: 34rem;
  margin: 14px 0 28px;
  color: rgba(255, 255, 255, 0.64);
  font-size: 14px;
  line-height: 1.5;
}

.party-code-form {
  display: grid;
  width: min(320px, 100%);
  gap: 10px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 16px;
  box-shadow: var(--party-shadow);
  text-align: left;
}

.party-code-form label {
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.party-code-form input {
  width: 100%;
  padding: 12px 14px;
  color: #fff;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 9px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
}

.party-code-form input::placeholder {
  color: rgba(255, 255, 255, 0.28);
}

.party-form-message {
  min-height: 18px;
  margin: 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

.party-viewer-view {
  position: relative;
  min-height: calc(100vh - 56px);
  overflow: hidden;
  background: #000;
}

.party-browser-source {
  display: block;
  width: 100%;
  height: calc(100vh - 56px);
  min-height: 480px;
  border: 0;
  background: #000;
}

.party-viewer-status {
  position: fixed;
  top: 10px;
  right: 16px;
  left: auto;
  z-index: 3;
  max-width: min(46vw, 360px);
  padding: 6px 9px;
  color: rgba(255, 255, 255, 0.88);
  background: rgba(18, 18, 18, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  font-size: 11px;
  pointer-events: none;
}

.party-viewer-status-message {
  display: none;
}

.party-viewer-status[data-state="connected"] {
  border-color: rgba(76, 175, 80, 0.52);
}

.party-viewer-status[data-state="expired"],
.party-viewer-status[data-state="invalid"] {
  border-color: rgba(244, 67, 54, 0.62);
}

.party-obs-mode,
.party-obs-mode .party-watch-shell,
.party-obs-mode .party-viewer-view,
.party-obs-mode .party-browser-source {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.party-obs-mode {
  height: 100vh;
  overflow: hidden;
}

.party-obs-mode .party-viewer-view {
  position: fixed;
  inset: 0;
}

.party-obs-mode .party-browser-source {
  height: 100vh;
  min-height: 0;
}

.party-obs-mode .party-viewer-status,
.party-obs-mode .party-viewer-status-message {
  display: none;
}

@media (max-width: 760px) {
  .party-session-bar {
    top: 8px;
    right: 8px;
    width: calc(100vw - 62px);
  }

  .party-session-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .party-session-button {
    width: 100%;
  }

  .party-watch-chrome {
    min-height: 48px;
    padding: 0 14px;
  }

  .party-viewer-status {
    top: 7px;
    right: 10px;
    padding: 5px 8px;
  }

  .party-code-view {
    min-height: calc(100vh - 48px);
    padding: 34px 0;
  }

  .party-viewer-view {
    min-height: calc(100vh - 48px);
  }

  .party-browser-source {
    height: calc(100vh - 48px);
    min-height: 320px;
  }
}
