:root {
  --ink: #1c140f;
  --paper: #f4efe6;
  --paper-dim: rgba(244, 239, 230, 0.72);
  --line: rgba(255, 248, 240, 0.16);
  --glass: rgba(22, 14, 10, 0.94);
  --live: #e23b2f;
  --private: #3ddc84;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  --sans: "Segoe UI", sans-serif;
  --serif: Palatino, "Palatino Linotype", "Book Antiqua", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #120d0a;
  color: var(--paper);
  font-family: var(--sans);
}

button, input { font: inherit; color: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.stage {
  position: fixed;
  inset: 0;
  background: #120d0a;
}

.stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  visibility: hidden;
  background: #120d0a;
}

.stage video.is-active {
  visibility: visible;
  z-index: 1;
}

.stage video.is-front {
  z-index: 2;
}

.topbar {
  position: fixed;
  top: 22px;
  left: 22px;
  right: 22px;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  pointer-events: none;
}

.top-actions, .brand, .live-switch, .sound, .queue-toggle, .world { pointer-events: auto; }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.live-badge, .viewers, .sound, .queue-toggle, .toast, .composer input, .send, .wallet {
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.icon {
  width: 18px;
  height: 18px;
  display: block;
  flex: none;
}

.live-switch { position: relative; }

.live-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px 0 10px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 0 rgba(226, 59, 47, 0.7);
  animation: pulse 1.6s ease-out infinite;
}

.live-lock {
  width: 13px;
  height: 13px;
  color: var(--private);
  filter: drop-shadow(0 0 4px rgba(61, 220, 132, 0.95));
  animation: lock-pulse 1.6s ease-out infinite;
}

.live-switch:not(.is-private) .live-badge .live-lock,
.live-switch.is-private .live-badge .live-dot { display: none; }

@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(226, 59, 47, 0); }
  100% { box-shadow: 0 0 0 0 rgba(226, 59, 47, 0); }
}

@keyframes lock-pulse {
  0% { filter: drop-shadow(0 0 2px rgba(61, 220, 132, 0.8)); }
  70% { filter: drop-shadow(0 0 9px rgba(61, 220, 132, 0)); }
  100% { filter: drop-shadow(0 0 2px rgba(61, 220, 132, 0.8)); }
}

.live-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 168px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.live-menu[hidden] { display: none; }

.live-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 13px;
}

.live-option[aria-checked="true"],
.live-option:hover {
  background: rgba(255, 248, 240, 0.08);
}

.top-actions { display: flex; gap: 8px; align-items: center; }

.viewers, .sound, .queue-toggle {
  height: 36px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  color: inherit;
}

.viewers, .queue-toggle { gap: 6px; padding: 0 12px 0 10px; cursor: pointer; }

#viewer-count, #queue-count {
  line-height: 1;
  transform: translateY(-2px);
}

.sound {
  width: 36px;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.world {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  color: var(--paper);
  background: none;
}

.world svg { width: 18px; height: 18px; display: block; }

.view-phone { display: none; }

html.is-phone .view-desktop { display: none; }

html.is-phone .view-phone { display: block; }

.sound .icon-sound-on { display: none; }

.sound.is-on .icon-sound-off { display: none; }

.sound.is-on .icon-sound-on { display: block; }

.toasts {
  position: fixed;
  top: 72px;
  left: 50%;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(440px, calc(100vw - 48px));
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: 12px 14px;
  border-radius: 16px;
  animation: rise 0.28s ease;
}

.toast strong {
  display: block;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 650;
}

.toast p {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.3;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 3;
  width: min(420px, calc(100vw - 44px));
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--paper-dim);
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.now-playing, .queue li {
  width: fit-content;
  max-width: 100%;
  margin: 0 0 8px;
  padding: 14px 16px 10px 16px;
  border-radius: 16px 16px 4px 16px;
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: #fff;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.35;
}

.bubble-text {
  margin: 0;
  font-size: 20px;
  line-height: 1.35;
}

.bubble-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.72);
  font-family: var(--sans);
  font-size: 11px;
  line-height: 1;
}

.ticks {
  display: inline-flex;
  width: 16px;
  height: 11px;
  color: rgba(255, 255, 255, 0.72);
}

.ticks svg { width: 16px; height: 11px; display: block; }

.ticks.is-read { color: #53bdeb; }

.queue-block {
  width: 100%;
  max-height: 220px;
  margin: 0 0 2px;
  overflow: auto;
}

.queue {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.queue li { margin: 0; }

.queue li.is-mine span::after,
.example-pill {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(244, 239, 230, 0.14);
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  vertical-align: 2px;
}

.queue li.is-mine span::after { content: "You"; }

.pay {
  width: 100%;
  margin: 0 0 8px;
  padding: 14px 16px 16px;
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: #fff;
}

.pay-request {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.35;
}

.pay-price {
  margin: 0 0 12px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pay-label {
  display: block;
  margin: 0 0 6px;
  font-size: 13px;
}

.pay-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.pay-row > div { flex: 1; min-width: 0; }

.card-field,
.pay-select,
.pay-zip {
  width: 100%;
  height: 46px;
  border-radius: 12px;
  background: #1c140f;
  border: 1px solid var(--line);
  color: #fff;
}

.card-field { padding: 14px 12px 0; }

.pay-select,
.pay-zip {
  display: block;
  margin: 0 0 10px;
  padding: 0 12px;
}

.pay-zip { margin-bottom: 0; }

.pay-error {
  margin: 10px 0 0;
  color: #ffb4a8;
  font-size: 13px;
  line-height: 1.35;
}

.pay-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.pay-back,
.pay-button {
  height: 42px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: #fff;
  cursor: pointer;
}

.pay-back {
  padding: 0 14px;
  background: transparent;
}

.pay-button {
  flex: 1;
  background: var(--glass);
  box-shadow: var(--shadow);
}

.pay-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.wallet-box {
  width: 100%;
  margin: 0 0 8px;
  padding: 14px 16px 16px;
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: #fff;
}

.wallet-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wallet-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #1c140f;
  border: 1px solid var(--line);
  font-size: 14px;
}

.wallet-exp {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.wallet-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.wallet-meta button,
.wallet-add {
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: 12px;
}

.wallet-default {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.wallet-add {
  width: 100%;
  height: 42px;
  margin-top: 12px;
  background: var(--glass);
  box-shadow: var(--shadow);
  font-size: 14px;
}

.wallet {
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.wallet[hidden] { display: none; }

.composer {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 0;
}

.composer input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border-radius: 999px;
  color: #fff;
  outline: none;
}

.composer input::placeholder {
  color: #fff;
  opacity: 1;
}

.composer input:focus { border-color: rgba(244, 239, 230, 0.45); }

.send {
  width: 46px;
  height: 46px;
  padding: 0;
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.send:disabled {
  opacity: 0.45;
  cursor: default;
}

.desktop-note {
  display: none;
}

html.is-phone .stage,
html.is-phone .stage video {
  background: #000;
}

html.is-phone .stage video {
  object-fit: cover;
  object-position: center center;
}

html.is-phone .topbar {
  top: max(12px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
}

html.is-phone .brand,
html.is-phone .top-actions {
  gap: 6px;
}

html.is-phone .live-badge,
html.is-phone .viewers,
html.is-phone .sound,
html.is-phone .queue-toggle {
  height: 32px;
  font-size: 12px;
}

html.is-phone .live-badge,
html.is-phone .viewers,
html.is-phone .queue-toggle {
  gap: 5px;
  padding: 0 10px 0 8px;
}

html.is-phone .sound {
  width: 32px;
}

html.is-phone .topbar .icon,
html.is-phone .world svg {
  width: 16px;
  height: 16px;
}

html.is-phone .world {
  width: 26px;
  height: 26px;
}

html.is-phone .live-dot {
  width: 7px;
  height: 7px;
}

html.is-phone .wallet {
  position: fixed;
  z-index: 5;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  width: 32px;
  height: 32px;
}

html.is-phone:has(.wallet:not([hidden])) .top-actions {
  margin-right: 38px;
}

html.is-phone .wallet-box {
  position: fixed;
  top: calc(max(12px, env(safe-area-inset-top)) + 40px);
  right: 12px;
  left: auto;
  z-index: 6;
  width: min(280px, calc(100vw - 24px));
  margin: 0;
}

html.is-phone .panel {
  left: 12px;
  right: 12px;
  bottom: max(12px, env(safe-area-inset-bottom));
  width: auto;
  align-items: flex-end;
}

html.is-phone .composer,
html.is-phone .pay {
  align-self: stretch;
}

html.is-phone .now-playing,
html.is-phone .queue li {
  max-width: 64%;
  margin-bottom: 6px;
  padding: 8px 10px 6px;
  border-radius: 14px 14px 4px 14px;
  font-size: 14px;
}

html.is-phone .bubble-text {
  font-size: 15px;
  line-height: 1.25;
}

html.is-phone .bubble-meta {
  margin-top: 4px;
  font-size: 10px;
}

html.is-phone .queue-block {
  width: 100%;
  overflow: auto;
  scroll-snap-type: y mandatory;
}

html.is-phone .queue li {
  scroll-snap-align: start;
}

html.is-phone .desktop-note {
  display: none;
}

@media (max-width: 960px) {
  .desktop-note {
    position: fixed;
    inset: 0;
    z-index: 8;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 24px;
    background: rgba(18, 13, 10, 0.82);
    text-align: center;
  }

  .desktop-note p {
    margin: 0;
    font-family: var(--serif);
    font-size: 28px;
  }

  .desktop-note p + p {
    font-family: var(--sans);
    font-size: 14px;
    letter-spacing: 0.04em;
    color: var(--paper-dim);
  }
}
