/* Shared look for every event: tokens follow the host site, so overlays read as part of the page. */

:root[data-ne-site="youtube"] {
  --ne-surface: #212121;
  --ne-surface-raised: #282828;
  --ne-fill: rgb(255 255 255 / 0.1);
  --ne-fill-hover: rgb(255 255 255 / 0.2);
  --ne-text: #f1f1f1;
  --ne-text-secondary: #aaa;
  --ne-accent: #f1f1f1;
  --ne-on-accent: #0f0f0f;
  --ne-brand: #f00;
  --ne-radius: 12px;
  --ne-radius-control: 18px;
  --ne-control-height: 36px;
  --ne-font: Roboto, Arial, sans-serif;
  --ne-font-display: "YouTube Sans", Roboto, sans-serif;
}

:root[data-ne-site="twitch"] {
  --ne-surface: #18181b;
  --ne-surface-raised: #1f1f23;
  --ne-fill: rgb(83 83 95 / 0.38);
  --ne-fill-hover: rgb(83 83 95 / 0.55);
  --ne-text: #efeff1;
  --ne-text-secondary: #adadb8;
  --ne-accent: #9147ff;
  --ne-on-accent: #fff;
  --ne-brand: #9147ff;
  --ne-radius: 8px;
  --ne-radius-control: 4px;
  --ne-control-height: 30px;
  --ne-font: Inter, Roobert, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --ne-font-display: Roobert, Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

:root {
  --ne-ease-out: cubic-bezier(0.2, 0, 0, 1);
}

.ne-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: var(--ne-control-height);
  padding: 0 16px;
  border: 0;
  border-radius: var(--ne-radius-control);
  background: var(--ne-fill);
  color: var(--ne-text);
  font: 500 14px/20px var(--ne-font);
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 150ms var(--ne-ease-out),
    filter 150ms var(--ne-ease-out),
    transform 120ms var(--ne-ease-out);
  -webkit-tap-highlight-color: transparent;
}

.ne-button:hover {
  background: var(--ne-fill-hover);
}

.ne-button:active {
  transform: scale(0.97);
}

.ne-button:focus-visible {
  outline: 2px solid var(--ne-text);
  outline-offset: 2px;
}

.ne-button[data-variant="primary"] {
  background: var(--ne-accent);
  color: var(--ne-on-accent);
}

.ne-button[data-variant="primary"]:hover {
  filter: brightness(0.9);
}

.ne-button[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

/* Dialog */

.ne-dialog {
  box-sizing: border-box;
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 24px;
  border: 0;
  border-radius: var(--ne-radius);
  background: var(--ne-surface);
  color: var(--ne-text);
  font: 400 14px/20px var(--ne-font);
  overflow: auto;
  overscroll-behavior: contain;
  opacity: 0;
  transform: scale(0.96);
  transition:
    opacity 130ms var(--ne-ease-out),
    transform 130ms var(--ne-ease-out);
}

.ne-dialog[data-size="wide"] {
  width: min(960px, calc(100vw - 32px));
}

.ne-dialog[data-size="plain"] {
  width: auto;
  max-width: calc(100vw - 32px);
  padding: 0;
  background: transparent;
  overflow: visible;
}

.ne-dialog::backdrop {
  background: rgb(0 0 0 / 0);
  transition: background-color 130ms var(--ne-ease-out);
}

.ne-dialog[data-open] {
  opacity: 1;
  transform: none;
  transition-duration: 200ms;
}

.ne-dialog[data-open]::backdrop {
  background: rgb(0 0 0 / 0.6);
  transition-duration: 200ms;
}

.ne-dialog-title {
  margin: 0 40px 16px 0;
  font: 700 20px/28px var(--ne-font-display);
  letter-spacing: 0;
}

/* Above full-bleed content, which comes later in the dialog and would otherwise cover it. */
.ne-dialog-close {
  position: absolute;
  z-index: 10;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ne-text);
  cursor: pointer;
  transition: background-color 150ms var(--ne-ease-out);
}

.ne-dialog-close:hover {
  background: var(--ne-fill);
}

.ne-dialog[data-size="plain"] .ne-dialog-close {
  position: fixed;
  top: 16px;
  right: 16px;
  background: rgb(0 0 0 / 0.5);
  backdrop-filter: blur(8px);
}

@media (max-width: 600px) {
  .ne-dialog:not([data-size="plain"]) {
    width: 100vw;
    max-width: 100vw;
    max-height: 90dvh;
    margin: auto 0 0;
    padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
    border-radius: var(--ne-radius) var(--ne-radius) 0 0;
    transform: translateY(24px);
  }

  .ne-dialog:not([data-size="plain"])[data-open] {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ne-button,
  .ne-dialog,
  .ne-dialog::backdrop {
    transition: none;
  }
}


.ne-tv-slot {
  position: relative;
}

.ne-tv {
  --ne-tv-t: 0;
  --ne-tv-r: 7px;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 3;
  width: 184px;
  font-family: var(--ne-font);
}

.ne-tv-offline {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
  color: var(--ne-text-secondary);
  font: 400 13px/18px var(--ne-font);
}

.ne-tv-offline-slot {
  position: relative;
  width: 200px;
  height: 38px;
}

.ne-tv-offline-slot .ne-tv,
.ne-tv[data-flow] {
  position: relative;
  top: auto;
  right: auto;
  width: 200px;
  margin-left: calc(-1 * var(--ne-tv-r));
}

.ne-tv[data-flow] {
  margin-top: 6px;
}

.ne-tv-offline-icon {
  display: inline-grid;
  color: var(--ne-text-secondary);
}

.ne-tv-offline-count {
  color: var(--ne-text);
  font-weight: 600;
}

.ne-tv-count {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ne-tv-count[data-infinite] {
  font-size: 1.4em;
  line-height: 0;
}

.ne-tv-icon[data-beating] {
  animation: ne-tv-beat var(--ne-tv-beat, 1s) var(--ne-ease-out) infinite;
}

@keyframes ne-tv-beat {
  0%,
  100% {
    transform: none;
  }
  30% {
    transform: scale(1.1);
  }
}

.ne-tv-slider {
  position: relative;
  height: 20px;
  cursor: pointer;
  touch-action: none;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.ne-tv-track {
  position: absolute;
  top: 50%;
  right: var(--ne-tv-r);
  left: var(--ne-tv-r);
  height: 4px;
  margin-top: -2px;
  border-radius: 2px;
  background: rgb(83 83 95 / 0.7);
  overflow: hidden;
  transition: height 150ms var(--ne-ease-out), margin-top 150ms var(--ne-ease-out);
}

.ne-tv-slider:hover .ne-tv-track,
.ne-tv[data-dragging] .ne-tv-track {
  height: 6px;
  margin-top: -3px;
}

.ne-tv-fill {
  height: 100%;
  background: var(--ne-accent);
  transform-origin: left;
  transform: scaleX(var(--ne-tv-t));
}

.ne-tv[data-max] .ne-tv-fill {
  background: #eb0400;
}

.ne-tv-thumb {
  position: absolute;
  top: 50%;
  left: calc(var(--ne-tv-r) + var(--ne-tv-t) * (100% - 2 * var(--ne-tv-r)));
  width: calc(2 * var(--ne-tv-r));
  height: calc(2 * var(--ne-tv-r));
  margin: calc(-1 * var(--ne-tv-r)) 0 0 calc(-1 * var(--ne-tv-r));
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px var(--ne-accent), 0 1px 4px rgb(0 0 0 / 0.4);
  transition: transform 150ms var(--ne-ease-out);
}

.ne-tv[data-dragging] .ne-tv-thumb {
  transform: scale(1.15);
}

.ne-tv[data-max] .ne-tv-thumb {
  box-shadow: 0 0 0 3px #eb0400, 0 1px 4px rgb(0 0 0 / 0.4);
}

.ne-tv-slider:focus-visible .ne-tv-thumb {
  outline: 2px solid var(--ne-text);
  outline-offset: 4px;
}

.ne-tv-caption {
  position: absolute;
  top: 100%;
  right: var(--ne-tv-r);
  margin: 0;
  color: var(--ne-text-secondary);
  font: 400 12px/16px var(--ne-font);
  white-space: nowrap;
}

.ne-tv-offline-slot .ne-tv-caption,
.ne-tv[data-flow] .ne-tv-caption {
  right: auto;
  left: var(--ne-tv-r);
}

.ne-tv[data-flow] {
  padding-bottom: 16px;
  margin-bottom: 8px;
}

@media (pointer: coarse) {
  .ne-tv-slider {
    height: 40px;
  }

  .ne-tv-track {
    height: 8px;
    margin-top: -4px;
  }

  .ne-tv {
    --ne-tv-r: 12px;
  }

  .ne-tv-offline-slot {
    height: 60px;
  }
}

.ne-tv[data-max] .ne-tv-caption {
  color: var(--ne-text);
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .ne-tv-icon[data-beating] {
    animation: none;
  }

  .ne-tv-track,
  .ne-tv-thumb {
    transition: none;
  }
}

/* Beside the name, so that the header stays where Twitch has it. */
@media (min-width: 1000px) {
  .ne-tv-offline-host {
    position: relative;
  }

  .ne-tv-offline-host > :is(.ne-tv-offline, .ne-tv-offline-slot) {
    position: absolute;
    left: calc(100% + 24px);
    margin: 0;
  }

  .ne-tv-offline-host > .ne-tv-offline {
    top: 2px;
    white-space: nowrap;
  }

  .ne-tv-offline-host > .ne-tv-offline-slot {
    top: 24px;
  }
}

.ne-tv-phone-slot {
  height: auto;
  margin: 0 16px 4px;
}
