/**
 * Watch chrome tokens. Spacing and radii match Expo `src/theme/tokens.ts`
 * (4 / 8 / 12 / 16 / 24 and 4 / 8 / 12). Colors stay the dark player
 * surface — not Expo light, not unused Expo `dark`.
 */
:root {
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
  --font-mono: "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --page: #000;
  --ink: #fff;
  --muted: #ccc;
  --dim: #777;
  --placeholder: #444;
  --surface: #111;
  --line: #555;
  --input-border: #262626;
  --divider: #1a1a1a;
  --footer: #333;
  --footer-link: #555;
  --footer-hover: #888;
  --live: #FF6060;
  --radius-sm: 4px;
  --radius-md: 8px;
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --type-footer: 12px;
  --type-caption: 13px;
  --type-small: 14px;
  --type-body: 16px;
  --type-title: 18px;
  --type-screen: 22px;
  --hit: 44px;
  /* 100vh is the large iOS viewport (under Safari chrome). svh/dvh are the visible sheet. */
  --watch-vh: 100vh;
  --watch-vh: 100svh;
  --watch-vh: 100dvh;
}

html {
  min-height: 100%;
  min-height: var(--watch-vh);
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

body {
  box-sizing: border-box;
  font-family: var(--font-sans);
  margin: 0;
  background-color: var(--page);
  color: var(--ink);
  min-height: var(--watch-vh);
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

h1 {
  font-size: var(--type-screen);
  font-weight: 700;
}

h2 {
  font-size: var(--type-body);
}

video {
  width: 100%;
}

#wrapper {
  flex: 1 0 auto;
  width: 100%;
  margin: 0 auto;
}

.btn {
  box-sizing: border-box;
  font-family: inherit;
  font-size: var(--type-small);
  font-weight: 600;
  line-height: 1.3;
  border-radius: var(--radius-md);
  cursor: pointer;
}

.btn-fill {
  background: var(--ink);
  color: var(--page);
  border: 1px solid var(--ink);
}

.btn-outline {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
}

.footer {
  box-sizing: border-box;
  align-self: center;
  flex-shrink: 0;
  width: auto;
  max-width: 100%;
  margin-top: auto;
  padding: var(--space-xl) 20px;
  font-family: var(--font-sans);
  font-size: var(--type-footer);
  color: var(--footer);
  line-height: 1.8;
  text-align: center;
}

.footer a {
  color: var(--footer-link);
  text-decoration: none;
}

.footer a:hover {
  color: var(--footer-hover);
}

.footer .sep {
  color: var(--footer);
  margin: 0 var(--space-xs);
}

#video-information {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  margin: 0;
  padding: var(--space-lg) 0 20px;
  background: var(--page);
  color: var(--ink);
}

#video-info-main {
  min-width: 0;
}

#video-information p {
  font-size: var(--type-small);
}

.time {
  display: flex;
  align-items: center;
  gap: calc(var(--space-lg) * 0.75);
  font-weight: 300;
  margin: 0;
  color: var(--ink);
}

.live {
  display: inline-block;
  padding: 2px var(--space-sm);
  border-radius: var(--radius-sm);
  background: var(--live);
  color: var(--ink);
  font-weight: 600;
  font-size: var(--type-footer);
  letter-spacing: 0.04em;
  line-height: 1.3;
}

.broadcast-status {
  color: var(--muted);
  font-weight: 400;
}

.broadcast-times {
  color: var(--ink);
  font-weight: 300;
}

.stream-error {
  position: relative;
  background-color: var(--page);
}

.stream-error h1,
#waiting-copy,
#paywall-title,
#preview-title {
  margin: 0;
  font-size: var(--type-screen);
  font-weight: 700;
  letter-spacing: 0.01em;
  text-align: center;
  color: var(--ink);
}

.stream-error h1 {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-sizing: border-box;
  width: 90%;
  padding: 0 var(--space-lg);
}

.broadcast-name {
  font-size: var(--type-title);
  font-weight: 400;
  color: var(--ink);
  margin: 0 0 var(--space-sm);
}

@media (min-width: 1000px) {
  h2 {
    font-size: 20px;
  }

  .broadcast-name {
    font-size: var(--type-title);
  }

  #wrapper {
    width: 80%;
  }
}

#video-container {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--page);
  height: auto;
  border-radius: var(--radius-md);
  overflow: hidden;
}

#video-container.paywall-active {
  border: 1px solid var(--line);
}

#video-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#video-container video.video-hidden,
#video-container.paywall-active video {
  visibility: hidden; /* not display:none — keeps the 16:9 box */
}

#video-container:focus {
  outline: none;
}

#video-container:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

#video-container:fullscreen {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  background: var(--page);
  border-radius: 0;
}

#start-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.35);
  color: var(--ink);
  cursor: pointer;
}

#start-overlay[hidden] {
  display: none;
}

.start-overlay-disc {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 6px;
}

#player-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  box-sizing: border-box;
  padding: var(--space-sm) 10px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
  color: var(--ink);
  opacity: 1;
  transition: opacity 0.25s ease;
}

#player-bar[hidden] {
  display: none;
}

#video-container.player-idle {
  cursor: none;
}

#video-container.player-idle #player-bar {
  opacity: 0;
  pointer-events: none;
}

#player-bar button {
  flex: 0 0 auto;
  min-width: var(--hit);
  min-height: var(--hit);
  margin: 0;
  padding: 0 var(--space-sm);
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: var(--type-small);
  font-weight: 600;
  cursor: pointer;
}

#ctrl-live {
  white-space: nowrap;
}

#ctrl-live:not([hidden]),
#ctrl-live[hidden] ~ #ctrl-mute {
  margin-left: auto;
}

#ctrl-live:not([hidden]) ~ #ctrl-mute {
  margin-left: 0;
}

#ctrl-seek {
  flex: 1 1 auto;
  min-width: 0;
  height: var(--hit);
  accent-color: var(--ink);
}

#preview-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  padding: var(--space-xs) var(--space-lg) 0;
  pointer-events: none;
}

#preview-title,
#preview-body {
  text-shadow: 0 1px 2px var(--page);
}

#paywall,
#waiting-stream {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-lg);
  background: var(--page);
}

#paywall-body,
#preview-body {
  font-size: var(--type-body);
  font-weight: 400;
}

#paywall-body {
  margin: var(--space-md) 0 0;
}

#preview-body {
  margin: var(--space-xs) 0 0;
}

#paywall[hidden],
#waiting-stream[hidden],
#preview-overlay[hidden],
#preview-cta[hidden],
#wallet-header[hidden],
#title-pay[hidden],
#pay-confirm[hidden] {
  display: none;
}

#wallet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  font-size: var(--type-small);
  min-width: 0;
}

#wallet-email,
#wallet-balance {
  font-weight: 700;
}

#wallet-email {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#wallet-header .wallet-header-right {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: var(--space-md);
}

.wallet-header-balance {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex: 0 0 auto;
}

#wallet-add-funds,
#title-pay-button {
  width: 7em;
  padding: var(--space-sm);
  white-space: nowrap;
}

#title-pay {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin-top: var(--space-lg);
  text-align: left;
}

.title-pay-rule {
  display: block;
  box-sizing: border-box;
  width: 100%;
  height: 1px;
  margin: 0 0 var(--space-lg);
  border: 0;
  background: var(--line);
  color: var(--line);
}

.title-pay-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: var(--space-lg);
}

.title-pay-copy {
  display: contents;
}

#title-pay-price {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  display: block;
  margin: 0;
  font-size: var(--type-body);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

#title-pay-helper {
  grid-column: 1;
  grid-row: 2;
  margin: var(--space-xs) 0 0;
  font-size: var(--type-caption);
  font-weight: 400;
  line-height: 1.4;
  color: var(--dim);
}

#title-pay-button {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  justify-self: end;
  margin: 0;
}

#pay-confirm {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-lg);
  background: rgba(0, 0, 0, 0.6);
}

.pay-confirm-dialog {
  box-sizing: border-box;
  width: min(360px, 100%);
  max-width: 100%;
  padding: var(--space-xl);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius-md);
}

#pay-confirm-body {
  margin: 0 0 20px;
  font-size: var(--type-body);
  font-weight: 400;
  line-height: 1.45;
  overflow-wrap: break-word;
}

.pay-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-md);
}

#pay-confirm-cancel,
#pay-confirm-ok {
  min-width: 88px;
  padding: var(--space-sm) var(--space-lg);
}

@media (max-width: 640px) {
  .pay-confirm-dialog {
    padding: var(--space-lg);
  }

  .pay-confirm-actions {
    flex-direction: column;
    align-items: stretch;
  }

  #pay-confirm-cancel,
  #pay-confirm-ok {
    width: 100%;
    min-width: 0;
  }
}

/* Below 1000px #wrapper is 100% wide. Keep the player full-bleed;
   inset everything else so type is not flush to the viewport. */
@media (max-width: 999px) {
  #wallet-header,
  #video-information,
  #preview-cta,
  #invoice-error {
    box-sizing: border-box;
    padding-left: max(var(--space-lg), env(safe-area-inset-left, 0px));
    padding-right: max(var(--space-lg), env(safe-area-inset-right, 0px));
  }

  #video-container {
    border-radius: 0;
  }
}

.wallet-checkout {
  box-sizing: border-box;
  max-width: 100%;
  /* Logo is gone; keep its old height + 32px gap so the title does not hug the top. */
  padding: calc(var(--space-xl) + 26px + 32px) var(--space-xl) 40px;
}

.wallet-checkout,
.wallet-checkout * {
  box-sizing: border-box;
}

@media (min-width: 1000px) {
  #wrapper.wallet-checkout {
    width: 50%;
    padding-top: calc(var(--space-xl) + 30px + 32px);
  }
}

.logo {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: 2px;
  margin: 0 0 32px;
}

.logo-spaced {
  margin-bottom: 80px;
}

/* Storefront event title matches checkout Add Funds to Wallet. */
.wallet-checkout .checkout-title,
.match-name {
  margin: 0;
  font-size: var(--type-screen);
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
}

.checkout-balance {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-sm) 0 0;
  font-size: var(--type-body);
  font-weight: 400;
  line-height: 1.4;
  color: var(--ink);
}

.checkout-balance-icon {
  width: 1.125em;
  height: 1.125em;
  flex: 0 0 auto;
  fill: currentColor;
}

.checkout-rule {
  display: block;
  width: 100%;
  height: 0;
  margin: var(--space-xl) 0 0;
  border: 0;
  border-top: 1px solid var(--ink);
}

.checkout-copy {
  margin: var(--space-xl) 0 0;
}

.checkout-copy p {
  margin: 0;
  color: var(--ink);
  font-size: var(--type-body);
  font-weight: 400;
  line-height: 1.5;
  overflow-wrap: break-word;
}

.checkout-copy p + p {
  margin-top: var(--space-xl);
}

.checkout-copy a {
  color: inherit;
  text-decoration: underline;
}

.checkout-step {
  margin-top: 32px;
}

.checkout-label {
  margin: 0 0 var(--space-lg);
  font-size: var(--type-body);
  font-weight: 600;
  line-height: 1.4;
  color: var(--ink);
}

.checkout-chips,
.checkout-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
}

.chip {
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--type-small);
  cursor: pointer;
}

.chip.selected {
  background: var(--ink);
  color: var(--page);
  border-color: var(--ink);
}

.chip:disabled {
  color: var(--dim);
  border-color: var(--placeholder);
  background: var(--surface);
  cursor: not-allowed;
}

.token-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
}

.token-logo {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  display: block;
}

#checkout-min {
  margin: 0 0 var(--space-lg);
  color: var(--muted);
  font-size: var(--type-small);
  line-height: 1.4;
  overflow-wrap: break-word;
}

.checkout-select-wrap {
  position: relative;
  display: inline-block;
}

.checkout-select {
  box-sizing: border-box;
  min-width: 168px;
  padding: 10px 40px 10px 14px;
  border: 1px solid var(--line);
  background-color: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: var(--type-small);
  line-height: 1.3;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  color-scheme: dark;
}

.checkout-select-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 0;
  height: 0;
  margin-top: -2px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 5px solid var(--ink);
  pointer-events: none;
}

#checkout-error {
  color: var(--live);
  margin-top: var(--space-md);
}

.checkout-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 40px;
}

.checkout-submit {
  width: auto;
  min-width: 140px;
  padding: var(--space-sm) var(--space-xl);
  font-size: var(--type-body);
}

@media (max-width: 640px) {
  #wrapper.wallet-checkout {
    width: 100%;
    max-width: 100%;
    padding: calc(var(--space-xl) + 26px + 32px) var(--space-lg) 40px;
  }

  .checkout-select-wrap {
    display: block;
    width: 100%;
  }

  .checkout-select {
    width: 100%;
    min-width: 0;
  }

  .checkout-tokens,
  .checkout-chips {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-md);
  }

  .chip,
  .token-chip {
    width: auto;
    min-width: 0;
    justify-content: center;
    min-height: var(--hit);
  }

  .checkout-actions {
    justify-content: stretch;
  }

  .checkout-submit {
    width: 100%;
    min-width: 0;
  }
}

.pay-now {
  width: min(320px, 100%);
  padding: var(--space-lg);
  font-size: var(--type-body);
  margin-top: var(--space-lg);
}

#paywall .pay-now {
  margin-bottom: 32px;
}

.paywall-sub {
  margin-top: 0;
}

body.storefront {
  justify-content: flex-start;
  align-items: center;
}

body.storefront,
body.storefront * {
  box-sizing: border-box;
}

body.storefront h1,
body.storefront p {
  margin: 0;
}

.storefront-wrap {
  width: 100%;
  max-width: 400px;
  padding: 20px;
  text-align: center;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.storefront .logo {
  margin-bottom: var(--space-sm);
}

.storefront .logo-spaced {
  margin-bottom: 80px;
}

.welcome {
  font-size: 15px;
  color: var(--dim);
  font-weight: 300;
  margin: 0;
  padding-bottom: 32px;
  border-bottom: 1px solid var(--divider);
}

.match {
  margin: 0;
  padding: 32px 0;
}

body.storefront .match.match-unruled {
  border-bottom: none;
}

/* Thanks page: date-to-copy gap = title-top gap (32px). Drop match
   bottom pad/margin so they cannot stack taller than the title. */
body.payment-return .match.match-unruled {
  margin-bottom: 0;
  padding-bottom: 0;
}

body.payment-return #event-chrome-host + .message {
  margin-top: 32px;
}

body.storefront .match > * + * {
  margin-top: var(--space-sm);
}

.subtitle {
  font-size: 15px;
  color: var(--muted);
  font-weight: 300;
}

.times {
  font-size: var(--type-small);
  color: var(--dim);
  font-weight: 300;
}

.stack > * + * {
  margin-top: var(--space-lg);
}

.message {
  font-size: 15px;
  color: var(--muted);
  font-weight: 300;
  line-height: 1.55;
}

.storefront-wrap > .message {
  margin-bottom: var(--space-lg);
}

.message strong {
  color: var(--ink);
  font-weight: 600;
}

.countdown {
  font-family: var(--font-mono);
  font-size: 28px;
  color: var(--ink);
  font-weight: 400;
}

.error {
  color: var(--live);
  font-size: 15px;
  font-weight: 300;
  line-height: 1.55;
}

.secondary {
  color: var(--footer-hover);
  font-size: 15px;
  font-weight: 400;
  text-decoration: underline;
}

a.secondary:hover {
  color: var(--muted);
}

.storefront input[type="email"],
.storefront input[type="text"] {
  width: 100%;
  padding: var(--space-lg);
  font-size: var(--type-title);
  font-family: inherit;
  text-align: center;
  background-color: var(--surface);
  color: var(--ink);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  outline: none;
  margin-bottom: var(--space-md);
  -webkit-appearance: none;
  box-sizing: border-box;
  transition: border-color 0.2s ease;
}

.storefront input[type="email"]:focus,
.storefront input[type="text"]:focus {
  border-color: var(--line);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}

.storefront input[type="email"]::placeholder,
.storefront input[type="text"]::placeholder {
  color: var(--placeholder);
}

.storefront button[type="submit"] {
  width: 100%;
  padding: var(--space-lg);
  font-size: var(--type-body);
  font-family: inherit;
  font-weight: 600;
  background-color: var(--ink);
  color: var(--page);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.storefront button[type="submit"]:hover {
  background-color: #e0e0e0;
}

.storefront button[type="submit"]:active {
  background-color: #bbb;
  transform: scale(0.99);
}

.storefront button.secondary {
  width: auto;
  padding: 0;
  font-size: 15px;
  font-weight: 400;
  background: none;
  color: var(--footer-hover);
  border-radius: 0;
  cursor: pointer;
}

.storefront button.secondary:hover,
.storefront button.secondary:active {
  background: none;
  color: var(--muted);
  transform: none;
}

.player-return {
  margin-top: 32px;
}

.player-return-link {
  display: inline-block;
  width: min(320px, 100%);
  padding: var(--space-lg);
  font-size: var(--type-body);
  font-weight: 600;
  background: var(--ink);
  color: var(--page);
  border-radius: var(--radius-md);
  text-decoration: none;
}

@media (min-width: 1000px) {
  .logo {
    font-size: 30px;
  }

  .welcome {
    font-size: var(--type-body);
  }
}

[hidden] {
  display: none;
}
